aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops/fetchGit.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/primops/fetchGit.cc')
-rw-r--r--src/libexpr/primops/fetchGit.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc
index f0f5b2a51..10cd2470a 100644
--- a/src/libexpr/primops/fetchGit.cc
+++ b/src/libexpr/primops/fetchGit.cc
@@ -112,7 +112,10 @@ GitInfo exportGit(ref<Store> store, std::string uri,
runProgram("git", true, { "init", "--bare", repoDir });
}
- Path localRefFile = repoDir + "/refs/heads/" + *ref;
+ Path localRefFile =
+ ref->compare(0, 5, "refs/") == 0
+ ? cacheDir + "/" + *ref
+ : cacheDir + "/refs/heads/" + *ref;
bool doFetch;
time_t now = time(0);