fix(scripts): match bash case-sensitivity for acronym retention in PowerShell branch names#3130
Open
Quratulain-bilal wants to merge 1 commit into
Open
Conversation
…anch names The branch-name generator keeps a short (<3 char) word only when it appears in uppercase in the description, treating it as an acronym (the comment says as much). The bash script uses a case-sensitive grep for this, but the PowerShell script used -match, which is case-insensitive by default. As a result every short non-stop word was retained on PowerShell even when lowercase, so the same description produced different branch names across the two shells (e.g. 'go AI now' -> 001-go-ai-now on PS vs 001-ai-now on bash). Switch to -cmatch so the check is case-sensitive and the two shells agree. Adds parity tests covering a dropped lowercase short word and a kept uppercase acronym.
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.
closes #3131
what
create-new-featurekeeps a short (<3 char) word in the generated branch name only when that word appears in uppercase in the description — the idea is to preserve acronyms likeAIorMLwhile dropping ordinary short words. The code comment says exactly this.the bash script does the check with a case-sensitive
grep:but the PowerShell script used
-match, which is case-insensitive by default:since the word being tested is itself lowercased earlier,
-matchagainst its uppercased form always matches — so on PowerShell every short non-stop word was kept, not just acronyms.impact
same description, different branch name depending on the shell:
go AI now001-ai-now001-go-ai-nowgo to the pub001-pub001-go-pubgois a 2-char non-stop word that is lowercase, so it should be dropped (and is, on bash). on PowerShell it leaked into the branch name.fix
switch
-matchto-cmatchso the comparison is case-sensitive, matching the bashgrep. one-character change plus a clarifying comment.tests
added parity tests (
TestShortWordRetentionBash/...PowerShell) covering a dropped lowercase short word and a kept uppercase acronym. verified the PowerShell case fails on the pre-fix script (go AI now->001-go-ai-now) and passes after.note: i used an ai assistant to help investigate and prepare this change. disclosing per CONTRIBUTING.md.