diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-07-02T13·44+0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-02T13·44+0200 |
commit | 33db1d35aeb0f56bad0bfe9dc211362793bfb75d (patch) | |
tree | b1e7c9212ea1d100b2099a3f8728f051d0f54bdf /src | |
parent | 5c8f4772836cc14393068a9adce642da224615c4 (diff) | |
parent | c8205a3413217ccf8a6a1f7e064b06a5b86c3253 (diff) |
Merge pull request #2582 from LnL7/fetchgit-refs
fetchGit: allow fetching explicit refs
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/primops/fetchGit.cc | 6 |
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); |