fetchGit: fix submodules = true for dirty trees

This commit is contained in:
Bjørn Forsman 2020-03-18 08:45:31 +01:00 committed by Julian Stecklina
parent b306b7039e
commit cc522d0d23

View file

@ -55,8 +55,12 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
gitInfo.rev = "0000000000000000000000000000000000000000"; gitInfo.rev = "0000000000000000000000000000000000000000";
gitInfo.shortRev = std::string(gitInfo.rev, 0, 7); gitInfo.shortRev = std::string(gitInfo.rev, 0, 7);
auto gitOpts = Strings({ "-C", uri, "ls-files", "-z" });
if (fetchSubmodules) {
gitOpts.emplace_back("--recurse-submodules");
}
auto files = tokenizeString<std::set<std::string>>( auto files = tokenizeString<std::set<std::string>>(
runProgram("git", true, { "-C", uri, "ls-files", "-z" }), "\0"s); runProgram("git", true, gitOpts), "\0"s);
PathFilter filter = [&](const Path & p) -> bool { PathFilter filter = [&](const Path & p) -> bool {
assert(hasPrefix(p, uri)); assert(hasPrefix(p, uri));