Use fetchGit on git worktrees
Git worktrees have a file for .git and can be loaded with fetchGit.
This commit is contained in:
parent
94cf59784c
commit
64de97c480
|
@ -76,12 +76,14 @@ let
|
||||||
rootSrc = let
|
rootSrc = let
|
||||||
dir = builtins.readDir src;
|
dir = builtins.readDir src;
|
||||||
gitDir = builtins.readDir (src + "/.git");
|
gitDir = builtins.readDir (src + "/.git");
|
||||||
isGitDir = dir ? ".git" && dir.".git" == "directory";
|
isGit = dir ? ".git";
|
||||||
isShallow = gitDir ? "shallow";
|
isGitDir = isGit && dir.".git" == "directory";
|
||||||
|
isShallow = isGitDir && gitDir ? "shallow";
|
||||||
# Try to clean the source tree by using fetchGit, if this source
|
# Try to clean the source tree by using fetchGit, if this source
|
||||||
# tree is a valid git repository.
|
# tree is a valid git repository.
|
||||||
|
# NB git worktrees have a file for .git, so we don't check the type of .git
|
||||||
tryFetchGit = src:
|
tryFetchGit = src:
|
||||||
if isGitDir && !isShallow
|
if isGit && !isShallow
|
||||||
then builtins.fetchGit src
|
then builtins.fetchGit src
|
||||||
else { outPath = src; };
|
else { outPath = src; };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue