]> git.wh0rd.org Git - home.git/commitdiff
git-rb-all: support worktrees better
authorMike Frysinger <vapier@gentoo.org>
Sun, 23 Feb 2020 18:13:00 +0000 (13:13 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sun, 23 Feb 2020 18:13:00 +0000 (13:13 -0500)
.bin/git-rb-all

index 122d85d2bffc2190445a9b0d21857632e99f1a46..be05ba65bb3de70c3c1565e7b10837570a12736f 100755 (executable)
@@ -41,7 +41,8 @@ main() {
        cd "$(git rev-parse --show-toplevel)" || return
 
        # Skip if rebase is in progress.
-       if [[ -e .git/rebase-merge/interactive ]] ; then
+       if [[ -e $(git rev-parse --git-path rebase-merge) || \
+          -e $(git rev-parse --git-path rebase-apply) ]] ; then
                printf "${BAD}skipping due to active rebase${NORMAL}\n"
                exit 1
        fi
@@ -51,7 +52,10 @@ main() {
 
        branches=( $(git for-each-ref --format='%(refname:short)' 'refs/heads/*') )
        for b in "${branches[@]}" ; do
-               rb_one "${b}" "${opts[@]}"
+               # If it's a branch in another worktree, ignore it.
+               if [[ $(git branch --list "${b}") != "+"* ]] ; then
+                       rb_one "${b}" "${opts[@]}"
+               fi
        done
 
        git checkout -q "${orig}"