Skip to content

fix(scripts): match bash case-sensitivity for acronym retention in PowerShell branch names#3130

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/ps-acronym-case-match
Open

fix(scripts): match bash case-sensitivity for acronym retention in PowerShell branch names#3130
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/ps-acronym-case-match

Conversation

@Quratulain-bilal

@Quratulain-bilal Quratulain-bilal commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

closes #3131

what

create-new-feature keeps 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 like AI or ML while dropping ordinary short words. The code comment says exactly this.

the bash script does the check with a case-sensitive grep:

elif echo "$description" | grep -q "${word^^}"; then

but the PowerShell script used -match, which is case-insensitive by default:

} elseif ($Description -match "$($word.ToUpper())") {

since the word being tested is itself lowercased earlier, -match against 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:

description bash powershell (before)
go AI now 001-ai-now 001-go-ai-now
go to the pub 001-pub 001-go-pub

go is 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 -match to -cmatch so the comparison is case-sensitive, matching the bash grep. 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.

…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.
@Quratulain-bilal Quratulain-bilal requested a review from mnriem as a code owner June 23, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: PowerShell create-new-feature keeps lowercase short words in branch names (case-insensitive -match)

1 participant