cleanGit: Detect when called inside a submodule (#847)
If cleanGit is called inside a submodule, the true gitdir is not available, so
fall back to cleanSourceWith as if called outside the repository.
commit3798469c3fb60d49dee858df39cecc59203af29a
authorThomas Tuegel <ttuegel@mailbox.org>
dateWed 16 Sep 2020, 05:25 (6 years ago)
parentb64fd96
lib/clean-git.nix+2−1
@@ -53,9 +53,10 @@ let
5353 lines = s: filter (x : x != [] && x != "") (split "\n" s);
5454
5555 origSrcSubDir = toString (src.origSrcSubDir or src);
56+ directoryExists = path: builtins.pathExists (builtins.toPath path + "/.");
5657in
5758
58−if builtins.pathExists (origSrcSubDir + "/.git")
59+if directoryExists (origSrcSubDir + "/.git")
5960then
6061 let
6162 hasIndex = builtins.pathExists (origSrcSubDir + "/.git/index");