Skip to content

Commit

Permalink
Fix bug in git-active-branches where it would error if branch name cl…
Browse files Browse the repository at this point in the history
…ashes with file/directory/tag name

Fixes #64
  • Loading branch information
nvie committed May 23, 2024
1 parent bc7e81f commit 0ad4a9a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions git-active-branches
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,22 @@ while [ $# -gt 0 ]; do
shift
done

( git local-branches; git remote-branches ) | while read branch; do
git local-branches | while read branch; do
# '--no-patch' = suppress diff output (long form of '-s')
maybebranch=$(
git log -1 --since="$since" --no-patch "$branch"
git log -1 --since="$since" --no-patch "refs/heads/$branch" --
)
[ -n "$maybebranch" ] && echo "$branch"
if [ -n "$maybebranch" ]; then
echo "$branch"
fi
done

git remote-branches | while read branch; do
# '--no-patch' = suppress diff output (long form of '-s')
maybebranch=$(
git log -1 --since="$since" --no-patch "$branch" --
)
if [ -n "$maybebranch" ]; then
echo "$branch"
fi
done

0 comments on commit 0ad4a9a

Please sign in to comment.