summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorJan Malakhovski <oxij@oxij.org>2018-11-07 09:07:42 +0000
committerJan Malakhovski <oxij@oxij.org>2018-11-08 05:20:18 +0000
commit2f5e4c733b1aa2caeb07c4c7637050a8e82dd506 (patch)
tree185c4c5e9815f0ffa5b496c3decb7d59480dac1c /lib
parentd2d80e6d308b0f3dec6db43768a916831c9d91f1 (diff)
downloadnixpkgs-2f5e4c733b1aa2caeb07c4c7637050a8e82dd506.tar
nixpkgs-2f5e4c733b1aa2caeb07c4c7637050a8e82dd506.tar.gz
nixpkgs-2f5e4c733b1aa2caeb07c4c7637050a8e82dd506.tar.bz2
nixpkgs-2f5e4c733b1aa2caeb07c4c7637050a8e82dd506.tar.lz
nixpkgs-2f5e4c733b1aa2caeb07c4c7637050a8e82dd506.tar.xz
nixpkgs-2f5e4c733b1aa2caeb07c4c7637050a8e82dd506.tar.zst
nixpkgs-2f5e4c733b1aa2caeb07c4c7637050a8e82dd506.zip
lib: commitIdFromGitRepo: simplify a tiny bit
Diffstat (limited to 'lib')
-rw-r--r--lib/sources.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sources.nix b/lib/sources.nix
index e64b23414e8..1a9f3f7d1f3 100644
--- a/lib/sources.nix
+++ b/lib/sources.nix
@@ -73,7 +73,7 @@ rec {
   # Get the commit id of a git repo
   # Example: commitIdFromGitRepo <nixpkgs/.git>
   commitIdFromGitRepo =
-    let readCommitFromFile = path: file:
+    let readCommitFromFile = file: path:
       with builtins;
         let fileName       = toString path + "/" + file;
             packedRefsName = toString path + "/packed-refs";
@@ -85,7 +85,7 @@ rec {
                  matchRef    = match "^ref: (.*)$" fileContent;
              in if   isNull matchRef
                 then fileContent
-                else readCommitFromFile path (lib.head matchRef)
+                else readCommitFromFile (lib.head matchRef) path
            # Sometimes, the file isn't there at all and has been packed away in the
            # packed-refs file, so we have to grep through it:
            else if lib.pathExists packedRefsName
@@ -96,7 +96,7 @@ rec {
                 then throw ("Could not find " + file + " in " + packedRefsName)
                 else lib.head matchRef
            else throw ("Not a .git directory: " + path);
-    in lib.flip readCommitFromFile "HEAD";
+    in readCommitFromFile "HEAD";
 
   pathHasContext = builtins.hasContext or (lib.hasPrefix builtins.storeDir);