From 824aa36b2aad310c35ae800ceb15c1199046f71b Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 12 Feb 2022 10:06:34 +0100 Subject: populate git: remove non-worktree target --- pkgs/populate/default.nix | 5 +++++ 1 file changed, 5 insertions(+) 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} -- cgit v1.2.3