mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-11 06:55:40 +03:00
Fix cleanGit when src is a git submodule. (#1469)
Suppose you have a repository with a submodule checked out in the subdirectory `smod`. `cleanGit { src = ./smod; }` would return the following error: error: getting status of '/.git/modules/smod': No such file or directory `smod/.git` is a file that contains a reference to the git module repo. gitdir: ../.git/modules/smod This is the same as a worktree (in fact, isWorktree = true here), but it's a relative path instead of an absolute path. Co-authored-by: Ewout Van Troostenberghe <evantroostenberghe@hubspot.com>
This commit is contained in:
parent
aa6d7a8e4b
commit
f1bb3aa2f2
@ -65,9 +65,13 @@ then
|
||||
first_line = head git_content;
|
||||
prefix = "gitdir: ";
|
||||
ok = length git_content == 1 && lib.hasPrefix prefix first_line;
|
||||
raw_path = remove_prefix prefix first_line;
|
||||
in
|
||||
if ok
|
||||
then /. + remove_prefix prefix first_line
|
||||
then
|
||||
if lib.hasPrefix "/" raw_path
|
||||
then /. + raw_path
|
||||
else /. + builtins.toPath (origSrcSubDir + "/" + raw_path)
|
||||
else abort "gitSource.nix: Cannot parse ${origSrcSubDir + "/.git"}";
|
||||
}));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user