Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,15 @@ jobs:
# (notably SC2155). Tighten in a follow-up after cleanup.
- name: Run shellcheck on shell scripts
run: git ls-files -z -- '*.sh' | xargs -0 shellcheck --severity=error

# macOS ships bash 3.2, where ${var^^} / ${var,,} error with "bad
# substitution". shellcheck assumes bash 4+ from the shebang and cannot
# flag these, so guard explicitly; use tr for portable case conversion.
- name: Reject bash 4+ case-modification expansions
run: |
matches=$(git ls-files -z -- '*.sh' | xargs -0 grep -nE '\$\{[A-Za-z_][A-Za-z0-9_]*(\[[^]]*\])?(\^|,)' || true)
if [ -n "$matches" ]; then
echo "Found bash 4+ case-modification expansion(s); use tr for portability (macOS ships bash 3.2):"
echo "$matches"
exit 1
fi
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<!-- insert new changelog below this comment -->

- fix(scripts): make branch-name acronym retention portable (uppercase via `tr` instead of bash-4-only `${word^^}`, whole-word match via `grep -w` instead of GNU/BSD-only `\b`), fixing acronym/short-word retention on macOS's default bash 3.2

## [0.11.9] - 2026-06-26

### Changed
Expand Down
4 changes: 3 additions & 1 deletion extensions/git/scripts/bash/create-new-feature-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ generate_branch_name() {
if ! echo "$word" | grep -qiE "$stop_words"; then
if [ ${#word} -ge 3 ]; then
meaningful_words+=("$word")
elif echo "$description" | grep -qw -- "${word^^}"; then
# Uppercase via tr (portable) rather than bash's 4+ "^^" case
# expansion, which breaks on macOS's default bash 3.2 (bad substitution).
elif echo "$description" | grep -qw -- "$(printf '%s' "$word" | tr '[:lower:]' '[:upper:]')"; then
meaningful_words+=("$word")
fi
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@ function Get-BranchName {
if ($word.Length -ge 3) {
$meaningfulWords += $word
} elseif ($Description -cmatch "\b$($word.ToUpper())\b") {
# Case-sensitive (-cmatch) to mirror the bash twin's `grep -qw -- "${word^^}"`:
# keep a short word only when its UPPERCASE form appears in the original
# (an acronym). -match is case-insensitive and would keep every short word.
# Case-sensitive (-cmatch) to mirror the bash twin's case-sensitive
# whole-word acronym match: keep a short word only when its UPPERCASE
# form appears in the original (an acronym). -match is case-insensitive
# and would keep every short word.
$meaningfulWords += $word
}
}
Expand Down
6 changes: 4 additions & 2 deletions scripts/bash/create-new-feature.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ generate_branch_name() {
if ! echo "$word" | grep -qiE "$stop_words"; then
if [ ${#word} -ge 3 ]; then
meaningful_words+=("$word")
elif echo "$description" | grep -q "\b${word^^}\b"; then
# Keep short words if they appear as uppercase in original (likely acronyms)
# Keep short words that appear as an uppercase acronym in the original.
# Uppercase via tr and match with grep -w (both portable) rather than
# bash's 4+ "^^" case expansion (breaks on macOS bash 3.2) and \b (non-POSIX).
elif echo "$description" | grep -qw -- "$(printf '%s' "$word" | tr '[:lower:]' '[:upper:]')"; then
meaningful_words+=("$word")
fi
fi
Expand Down