From: Mike Frysinger Date: Sun, 23 Feb 2020 18:13:00 +0000 (-0500) Subject: git-rb-all: support worktrees better X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ba2f60e0f362591ff9417966a99fe36653310350;p=home.git git-rb-all: support worktrees better --- 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}"