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:43:46 +0100
commitf7a155f1a9347400ba37e2c9e7dd2fb4e413205e (patch)
tree080b35a5d08066bf62df9d9b01e229e2bb91e535
parent9df5b598ec2aa715dea8d61fc261186968222c4e (diff)
downloadscripts-f7a155f1a9347400ba37e2c9e7dd2fb4e413205e.tar.gz
scripts-f7a155f1a9347400ba37e2c9e7dd2fb4e413205e.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