From f4c569bb0c7c65e5e2f26e11214cc194590049b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 27 Dec 2018 15:10:14 +0100 Subject: utils: fix problem with old missing worktrees New version of git fails if there is some work tree that is no longer accessible. I have no idea if this is a bug or not (I expect it to be) but true is that until now all previously used work trees were preserved which means that we have a lot of old work trees in bare repository. This changes that and should ensure that work tree is created even if some other work tree is missing. --- scripts/utils | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/utils b/scripts/utils index 8837c3c..1c56d1d 100644 --- a/scripts/utils +++ b/scripts/utils @@ -39,7 +39,8 @@ _git_fetch() { local BRANCH="$3" [ -n "$BRANCH" ] || BRANCH=master git_fetch_bare "$1" "$4/$2" - git --git-dir="$4/$2" --bare worktree add --detach "$2" "$BRANCH" + git --git-dir="$4/$2" --bare worktree prune # remove old work trees + git --git-dir="$4/$2" --bare worktree add --force --detach "$2" "$BRANCH" } # Fetch git repository with mirror -- cgit v1.2.3