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.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc
index 391308224..40975d8d8 100644
--- a/src/libexpr/primops/fetchGit.cc
+++ b/src/libexpr/primops/fetchGit.cc
@@ -39,6 +39,7 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
files. */
GitInfo gitInfo;
+ gitInfo.ref = "HEAD";
gitInfo.rev = "0000000000000000000000000000000000000000";
gitInfo.shortRev = std::string(gitInfo.rev, 0, 7);
@@ -67,7 +68,6 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
// clean working tree, but no ref or rev specified. Use 'HEAD'.
rev = chomp(runProgram("git", true, { "-C", uri, "rev-parse", "HEAD" }));
- ref = "HEAD"s;
}
if (!ref) ref = "HEAD"s;
@@ -127,6 +127,7 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
// FIXME: check whether rev is an ancestor of ref.
GitInfo gitInfo;
+ gitInfo.ref = *ref;
gitInfo.rev = rev != "" ? rev : chomp(readFile(localRefFile));
gitInfo.shortRev = std::string(gitInfo.rev, 0, 7);