diff options
-rw-r--r-- | pkgs/populate/default.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix index bf6f76d..2474464 100644 --- a/pkgs/populate/default.nix +++ b/pkgs/populate/default.nix @@ -63,6 +63,11 @@ let pop.git = target: source: runShell target /* sh */ '' set -efu + # Remove target path if it doesn't look like a git worktree. + # This can happen e.g. when it had a different type earlier. + if ! test -e ${quote target.path}/.git; then + rm -fR ${quote target.path} + fi if ! test -e ${quote target.path}; then ${if source.shallow then /* sh */ '' git init ${quote target.path} |