You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Treat GIT_BRANCH_NAME naming the current branch as a no-op - #5006
With GIT_BRANCH_NAME set to the branch that is already checked out, git checkout -b fails, so the feature-branch script reported "Branch already exists" and exited 1 unless --allow-existing-branch was passed. The branch is already in the requested state, so the bash, PowerShell and Python scripts now succeed without switching, as the --allow-existing-branch path does. A GIT_BRANCH_NAME naming a different existing branch still fails.
Testing
Existing and new tests in the git extension suites: 129 passed, 0 failed (the new tests fail without the fix). I did not run the other checks.
Tested locally with uv run specify --help
Ran existing tests with uv sync && uv run pytest
Tested with a sample project (if applicable)
AI Disclosure
I did not use AI assistance for this contribution
I did use AI assistance (fill in the disclosure below)
AI disclosure: Code and tests written by Claude Code (model: Claude Sonnet 5.5, autonomous), reviewed by two further agent passes.
Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
When GIT_BRANCH_NAME names the branch that is already checked out,
`git checkout -b` fails and the script reported "Branch already exists"
and exited 1, unless --allow-existing-branch was passed. The branch is
already in the requested state, so handle it the way the
--allow-existing-branch path does and succeed without switching.
Applied to the bash, PowerShell and Python scripts. A GIT_BRANCH_NAME
naming a different existing branch still fails.
Fixesgithub#5003
Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
Add a PowerShell twin of the bash test for GIT_BRANCH_NAME naming the
checked-out branch, use a case-sensitive comparison in the new
PowerShell clause so a differently-cased branch is not mistaken for the
current one, and document the behaviour in speckit.git.feature.md.
Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
…g branch
Mirror the Python parity negative test: without -AllowExistingBranch, a
GIT_BRANCH_NAME naming a different existing branch must exit 1, report
that the branch already exists, and leave HEAD unchanged.
Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)
Pushed 83df0e0: the PowerShell counterpart of the different-existing-branch test (exit 1, "already exists", HEAD unchanged). With pwsh 7.6.7, tests/extensions/git passes 181/181. On Windows PowerShell 5.1: the script change is one condition built from -or, -and, -ceq and $env:, all available in 5.1; I have no 5.1 host to run it on.
This changes the bundled git extension, but extensions/git/extension.yml and its extensions/catalog.json entry still declare 1.0.1. The version guard rejects content changes without a version increase (.github/scripts/check_extension_version_bump.py:172–177). Existing installs also will not be offered the fix because updates are version-driven, as documented in extensions/EXTENSION-DEVELOPMENT-GUIDE.md:631–637.
Please bump both versions to 1.0.2 and update the pinned version assertion in tests/extensions/git/test_git_extension.py:148.
AI disclosure: GitHub Copilot (model: unknown, autonomous), acting for the requesting contributor; analysis and this comment are AI-generated.
The bundled git extension's scripts changed, so raise its version in
extension.yml and catalog.json and update the pinned manifest version
in the git extension tests. Installed copies are only offered the fix
when the version increases.
Assisted-by: Claude Code (model: Claude Opus 5.5, autonomous)
Pushed a83c367: bumped the bundled git extension version in extension.yml and catalog.json and updated the pinned version in its manifest test, so the Extension Version Guard passes.
The new condition appears compatible with PowerShell 5.1, but the reported PowerShell 7.6.7 tests do not validate our required runtime. Please run the regression cases under Windows PowerShell 5.1 (powershell.exe): the current-branch override must succeed without switching, and an override naming a different existing branch must fail without switching. Include the exact commands, $PSVersionTable output, and results, with before/after evidence for the fixed case.
I ran both regression cases under Windows PowerShell 5.1 (powershell.exe) on a GitHub-hosted windows-latest runner, using a scratch workflow in my fork: run 40943081027, workflow file. Each case runs in a fresh temp repo set up like _setup_project in the tests. "Before" is the script at the base c6a4c18f, "after" is the script at a83c3676.
Case A: the override names the current branch (setup: git checkout -q -b feature/PROJ-42-login, override feature/PROJ-42-login)
Before (c6a4c18f):
HEAD before: feature/PROJ-42-login
Error: Branch 'feature/PROJ-42-login' already exists. Please use a different feature name or specify a different number with -Number.
exit code: 1
HEAD after: feature/PROJ-42-login
After (a83c3676):
HEAD before: feature/PROJ-42-login
{"BRANCH_NAME":"feature/PROJ-42-login","FEATURE_NUM":"feature/PROJ-42-login"}
exit code: 0
HEAD after: feature/PROJ-42-login
Case B: the override names a different existing branch (setup: git branch feature/other while on main, override feature/other)
Before (c6a4c18f):
HEAD before: main
Error: Branch 'feature/other' already exists. Please use a different feature name or specify a different number with -Number.
exit code: 1
HEAD after: main
After (a83c3676):
HEAD before: main
Error: Branch 'feature/other' already exists. Please use a different feature name or specify a different number with -Number.
exit code: 1
HEAD after: main
So on 5.1 the current-branch override now exits 0 without switching branches, and an override naming another existing branch still exits 1 with "already exists" and leaves HEAD where it was. The full log, including the Write-Error record lines I trimmed here, is in the run linked above.
This branch has not been deployed
No deployments
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
triage-must-haveVerdict: high-value, important work for Spec Kit — do first
3 participants
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.
Fixes #5003.
Description
With
GIT_BRANCH_NAMEset to the branch that is already checked out,git checkout -bfails, so the feature-branch script reported "Branch already exists" and exited 1 unless--allow-existing-branchwas passed. The branch is already in the requested state, so the bash, PowerShell and Python scripts now succeed without switching, as the--allow-existing-branchpath does. AGIT_BRANCH_NAMEnaming a different existing branch still fails.Testing
Existing and new tests in the git extension suites: 129 passed, 0 failed (the new tests fail without the fix). I did not run the other checks.
uv run specify --helpuv sync && uv run pytestAI Disclosure
AI disclosure: Code and tests written by Claude Code (model: Claude Sonnet 5.5, autonomous), reviewed by two further agent passes.
Assisted-by: Claude Code (model: Claude Sonnet 5.5, autonomous)