Repository navigation
fix(branch): pass HEAD to --merged when deleting merged branches - #81
Merged
Merged
Conversation
`git branch --merged --format=...` fails with "malformed object name --format=%(refname:short)" because --merged takes an optional commit and git consumes the next argument as it. Deleting merged branches from `gitb branch delete` therefore did nothing. Pass HEAD explicitly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N7bXuSKAQZEE7BsHZdjQ21
|
🎉 This PR is included in version 5.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gitb branch delete→ "Delete these merged branches? y" failed withfatal: malformed object name --format=%(refname:short)and deleted nothing.git branch --mergedtakes an optional commit argument, so git read the following--format=...as that commit. The fix passesHEADexplicitly:git branch --merged HEAD --format='%(refname:short)'.--merged/--no-mergedis ever followed directly by another flag inscripts/.Linked issue
None. The bug was reported directly with a screenshot of the failing prompt.
Type of change
Test plan
bats tests/test_branch_operations.bats: the new static check fails on the old code and passes with the fix. The pre-existing tests 4, 5 and 14 fail either way because the test container has nocolumnbinary.shellcheck scripts/*.sh install.sh: shellcheck isn't installed in the test environmentbash dist/build.sh ./scripts/gitb.sh ./dist/gitb dev && bash ./dist/gitb --versionCompatibility
Checklist
gitinvocations are quotedxargs -r/ GNU-only patterns🤖 Generated with Claude Code
https://claude.ai/code/session_01N7bXuSKAQZEE7BsHZdjQ21
Generated by Claude Code