Skip to content

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

Merged
mnriem merged 1 commit into
github:mainfrom
Quratulain-bilal:fix/ps-acronym-case-match
Jun 24, 2026
Merged

fix(scripts): match bash case-sensitivity for acronym retention in PowerShell branch names#3130
mnriem merged 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a cross-shell behavioral inconsistency in create-new-feature branch naming by making PowerShell’s short-word/acronym retention check case-sensitive, matching the existing bash behavior. It also adds regression tests to ensure bash and PowerShell produce identical branch names for the same descriptions.

Changes:

  • Switched PowerShell acronym detection from -match to -cmatch to enforce case-sensitive matching (so only truly-uppercase acronyms are retained).
  • Added bash + PowerShell parity tests covering (1) dropping lowercase short words and (2) retaining uppercase acronyms.
  • Added a small shared test helper to extract BRANCH_NAME: from script stdout.
Show a summary per file
File Description
scripts/powershell/create-new-feature.ps1 Uses -cmatch (case-sensitive) for uppercase-acronym detection so PowerShell matches bash behavior.
tests/test_timestamp_branches.py Adds cross-shell regression tests ensuring short-word/acronym branch naming parity between bash and PowerShell.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@Quratulain-bilal

Copy link
Copy Markdown
Contributor Author

@mnriem whenever you get a chance - this one's ready: small case-sensitivity fix with parity tests for both shells. happy to adjust if anything looks off.

@mnriem mnriem merged commit 37e0e71 into github:main Jun 24, 2026
11 checks passed
@mnriem

mnriem commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

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)

3 participants