summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-11-11 15:42:31 +0100
committerSlávek Banko <slavek.banko@axis.cz>2020-11-11 15:44:05 +0100
commit041fa76284cc3ba797efa8ee91242783faf6eef2 (patch)
tree93c46a680554023ef506002e0901c044cc2c57d9
parentb43f26a7ccd1dd92257163fa9fcfd5f00218e507 (diff)
downloadscripts-041fa76284cc3ba797efa8ee91242783faf6eef2.tar.gz
scripts-041fa76284cc3ba797efa8ee91242783faf6eef2.zip
switch_all_submodules_to_head_and_clean: Clean up abandoned worktrees
before adding a new worktree. Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 5b81e0aa93702515e5ced5a1ebde5bcb1065190e)
-rwxr-xr-xswitch_all_submodules_to_head_and_clean1
1 files changed, 1 insertions, 0 deletions
diff --git a/switch_all_submodules_to_head_and_clean b/switch_all_submodules_to_head_and_clean
index 5ca3d13..2c136fd 100755
--- a/switch_all_submodules_to_head_and_clean
+++ b/switch_all_submodules_to_head_and_clean
@@ -134,6 +134,7 @@ updateModule() {
(
cd $REPO_LOCALTREE &&
git fetch &&
+ git worktree prune &&
git worktree add $PARENTDIR/$MODULE$submodule $branch &&
cd $PARENTDIR/$MODULE$submodule &&
git branch --set-upstream-to=origin/$branch