aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2020-03-17 14:27:14 +0100
committerJulian Stecklina <js@alien8.de>2020-03-29 22:29:58 +0200
commit6864ad7cf510d96f0cfc0cdbeffc1188a4eab44c (patch)
treeaf571cb9efeed244ceec49d689f9835919c5388d /src
parent587e259bfdda248fb2d81389faca816b8efdb5f6 (diff)
fetchGit: fix submodule output attribute
Before this change it would be false for all evaluations but the first. Now it follows the input argument (as it should).
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/primops/fetchGit.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc
index 66259d778..653d99b53 100644
--- a/src/libexpr/primops/fetchGit.cc
+++ b/src/libexpr/primops/fetchGit.cc
@@ -32,6 +32,9 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
std::optional<std::string> ref, std::string rev,
const std::string & name, bool fetchSubmodules)
{
+ GitInfo gitInfo;
+ gitInfo.submodules = fetchSubmodules;
+
if (evalSettings.pureEval && rev == "")
throw Error("in pure evaluation mode, 'fetchGit' requires a Git revision");
@@ -49,7 +52,6 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
if (!clean) {
/* This is an unclean working tree. So copy all tracked files. */
- GitInfo gitInfo;
gitInfo.rev = "0000000000000000000000000000000000000000";
gitInfo.shortRev = std::string(gitInfo.rev, 0, 7);
@@ -141,7 +143,6 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
}
// FIXME: check whether rev is an ancestor of ref.
- GitInfo gitInfo;
gitInfo.rev = rev != "" ? rev : chomp(readFile(localRefFile));
gitInfo.shortRev = std::string(gitInfo.rev, 0, 7);
@@ -190,8 +191,6 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
std::filesystem::remove_all(p.path());
}
}
-
- gitInfo.submodules = true;
} else {
auto source = sinkToSource([&](Sink & sink) {
RunOptions gitOptions("git", { "-C", cacheDir, "archive", gitInfo.rev });