From ba2f60e0f362591ff9417966a99fe36653310350 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 23 Feb 2020 13:13:00 -0500 Subject: [PATCH] git-rb-all: support worktrees better --- .bin/git-rb-all | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.bin/git-rb-all b/.bin/git-rb-all index 122d85d..be05ba6 100755 --- a/.bin/git-rb-all +++ b/.bin/git-rb-all @@ -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}" -- 2.39.2