Skip to content

Commit

Permalink
Flakes: don't insist files need to be managed by git
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Nov 16, 2022
1 parent 0275e4d commit bf9922e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/libfetchers/git.cc
Original file line number Diff line number Diff line change
Expand Up @@ -372,16 +372,15 @@ struct GitInputScheme : InputScheme
if (repoInfo.hasHead) {
// Using git diff is preferrable over lower-level operations here,
// because it's conceptually simpler and we only need the exit code anyways.
auto gitDiffOpts = Strings({ "-C", repoInfo.url, "--git-dir", repoInfo.gitDir, "diff", "HEAD", "--quiet"});
auto gitDiffOpts = Strings({ "-C", repoInfo.url, "--git-dir", repoInfo.gitDir, "status", "--short"});
if (!repoInfo.submodules) {
// Changes in submodules should only make the tree dirty
// when those submodules will be copied as well.
gitDiffOpts.emplace_back("--ignore-submodules");
}
gitDiffOpts.emplace_back("--");
runProgram("git", true, gitDiffOpts);

repoInfo.isDirty = false;
repoInfo.isDirty = (chomp(runProgram("git", true, gitDiffOpts)) == "");
}
} catch (ExecError & e) {
if (!WIFEXITED(e.status) || WEXITSTATUS(e.status) != 1) throw;
Expand All @@ -393,7 +392,7 @@ struct GitInputScheme : InputScheme

std::set<CanonPath> listFiles(const RepoInfo & repoInfo) const
{
auto gitOpts = Strings({ "-C", repoInfo.url, "--git-dir", repoInfo.gitDir, "ls-files", "-z" });
auto gitOpts = Strings({ "-C", repoInfo.url, "--git-dir", repoInfo.gitDir, "ls-files", "--cached", "-z" , "--others"});
if (repoInfo.submodules)
gitOpts.emplace_back("--recurse-submodules");

Expand Down

0 comments on commit bf9922e

Please sign in to comment.