about summary refs log tree commit diff
path: root/src/libexpr/primops
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-07-02T13·44+0200
committerGitHub <noreply@github.com>2019-07-02T13·44+0200
commit33db1d35aeb0f56bad0bfe9dc211362793bfb75d (patch)
treeb1e7c9212ea1d100b2099a3f8728f051d0f54bdf /src/libexpr/primops
parent5c8f4772836cc14393068a9adce642da224615c4 (diff)
parentc8205a3413217ccf8a6a1f7e064b06a5b86c3253 (diff)
Merge pull request #2582 from LnL7/fetchgit-refs
fetchGit: allow fetching explicit refs
Diffstat (limited to 'src/libexpr/primops')
-rw-r--r--src/libexpr/primops/fetchGit.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc
index 3dcf3e9ff862..6229fef8d02e 100644
--- a/src/libexpr/primops/fetchGit.cc
+++ b/src/libexpr/primops/fetchGit.cc
@@ -94,7 +94,11 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
         runProgram("git", true, { "init", "--bare", cacheDir });
     }
 
-    Path localRefFile = cacheDir + "/refs/heads/" + *ref;
+    Path localRefFile;
+    if (ref->compare(0, 5, "refs/") == 0)
+        localRefFile = cacheDir + "/" + *ref;
+    else
+        localRefFile = cacheDir + "/refs/heads/" + *ref;
 
     bool doFetch;
     time_t now = time(0);