Fix remote name detection to work with bash-it repo#2344
Merged
seefood merged 3 commits intoBash-it:masterfrom Oct 7, 2025
Merged
Fix remote name detection to work with bash-it repo#2344seefood merged 3 commits intoBash-it:masterfrom
seefood merged 3 commits intoBash-it:masterfrom
Conversation
Addresses review feedback on PR Bash-it#2318: - Rename function to _get-git-default-remote-name (dash naming convention) - Scope function to operate on BASH_IT directory, not CWD - Add command prefix to git commands for safety Original implementation by Edwin Kofler (@hyperupcall) Co-Authored-By: Edwin Kofler <[email protected]> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
8 tasks
akinomyoga
reviewed
Oct 5, 2025
Addresses @akinomyoga's review feedback on PR Bash-it#2344: 1. **Replace pushd/popd with git --git-dir/--work-tree** - More direct approach without changing shell directory - Avoids side effects from directory changes - Cleaner code without need for popd cleanup 2. **Simplify awk command** - Changed from: `awk 'NR==1 { name=$1; print name } $1 != name { exit 1 }'` - Changed to: `awk 'NR==1 { print $1 }'` - Use bash parameter expansion `${remote_name:-origin}` for fallback - Simpler, more readable, same behavior **Testing:** - ✅ Function correctly returns 'fork' for current repo - ✅ Function correctly returns 'me' for test repo with non-standard remote - ✅ Shellcheck passes with no warnings Co-authored-by: akinomyoga <[email protected]> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Contributor
Author
|
Applied both review feedback items from @akinomyoga:
The function is now cleaner (8 lines shorter) and doesn't change shell directory. All tests pass including shellcheck. |
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
Fixes #2318 by addressing all review feedback:
_remote_name()to_get-git-default-remote-name()(dash naming convention per @seefood)$BASH_ITdirectory instead of CWD (per @akinomyoga)commandprefix to git commands for safety_bash-it-update-()and_bash-it-version()Changes
The function now uses
pushd "${BASH_IT}"to ensure it operates on the bash-it repository directory, not the current working directory. This was the main issue identified in the review.Attribution
Original implementation by @hyperupcall in PR #2318.
This PR supersedes #2318 with the requested changes applied.
Test Plan
🤖 Generated with Claude Code