aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-02-12 10:06:34 +0100
committertv <tv@krebsco.de>2022-02-12 10:06:34 +0100
commit824aa36b2aad310c35ae800ceb15c1199046f71b (patch)
treebd2250693e677461d71abe997dfa429327307429 /pkgs
parent13ae434b140035e7e2664bd5a8ef4c475413b2e0 (diff)
populate git: remove non-worktree target
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/populate/default.nix5
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}