summaryrefslogtreecommitdiff
path: root/scripts/utils
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-12-27 15:10:14 +0100
committerKarel Kočí <cynerd@email.cz>2018-12-27 15:10:14 +0100
commitf4c569bb0c7c65e5e2f26e11214cc194590049b0 (patch)
treeb05da5a1552c45aa62df3d5c6aef98ff9b7a041a /scripts/utils
parentb4ca089ce19b82623cddbb367df1e42c7993f774 (diff)
downloadlaminar-cnf-f4c569bb0c7c65e5e2f26e11214cc194590049b0.tar.gz
laminar-cnf-f4c569bb0c7c65e5e2f26e11214cc194590049b0.tar.bz2
laminar-cnf-f4c569bb0c7c65e5e2f26e11214cc194590049b0.zip
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.
Diffstat (limited to 'scripts/utils')
-rw-r--r--scripts/utils3
1 files changed, 2 insertions, 1 deletions
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