Skip to content

fix(scripts): git-ext PowerShell emits the '# To persist' SPECIFY_FEATURE hint (parity)#3632

Open
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/git-ext-ps-persist-hint-parity
Open

fix(scripts): git-ext PowerShell emits the '# To persist' SPECIFY_FEATURE hint (parity)#3632
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/git-ext-ps-persist-hint-parity

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

What

The Git extension's create-new-feature-branch.ps1 prints a non-JSON hint that diverges from every twin:

SPECIFY_FEATURE environment variable set to: 001-add-user-auth

Its bash twin (create-new-feature-branch.sh), its python twin (create_new_feature_branch.py), and the core create-new-feature.ps1 all emit:

# To persist in your shell: $env:SPECIFY_FEATURE = '001-add-user-auth'

The old wording is also misleading: $env:SPECIFY_FEATURE is set only in this child process and never propagates to the agent's shell, so the actionable output is precisely the persist hint the siblings print.

Fix

Mirror the core PowerShell twin: build $featureAssignment = '$env:SPECIFY_FEATURE = ' + $quotedBranchName (single-quoted, '-escaped) and change the output line to # To persist in your shell: $featureAssignment. BRANCH_NAME/FEATURE_NUM lines are untouched.

Test

test_persist_hint_matches_twins (pwsh CI): the non-JSON output uses # To persist in your shell: $env:SPECIFY_FEATURE = '001-persist' — fails before (old wording). Verified end-to-end via powershell.exe:

BRANCH_NAME: 001-persist
FEATURE_NUM: 001
# To persist in your shell: $env:SPECIFY_FEATURE = '001-persist'

Merge precedent for this exact bash-parity vein on these files: #3195, #3129/#3130.


🤖 Written with the assistance of Claude Code (AI). Bug self-found; fix/tests verified locally (fail-before / pass-after), ruff & ASCII-only checks clean.

…TURE hint (parity)

The Git extension's create-new-feature-branch.ps1 printed a non-JSON hint
'SPECIFY_FEATURE environment variable set to: <name>', diverging from every
twin: the bash (create-new-feature-branch.sh) and python
(create_new_feature_branch.py) siblings of the same extension, and the core
create-new-feature.ps1, all emit '# To persist in your shell:
$env:SPECIFY_FEATURE = '<name>''. The old wording is also misleading —
$env:SPECIFY_FEATURE is set only in this child process and never reaches the
agent's shell, so the actionable output is the persist hint. Mirror the core PS
twin's $featureAssignment construction and message.

Test (pwsh CI): the non-JSON output uses the '# To persist in your shell:' form
(fails before: old wording). Verified end-to-end via powershell.exe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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

Aligns the git extension’s PowerShell persistence hint with its sibling implementations.

Changes:

  • Emits an actionable $env:SPECIFY_FEATURE assignment.
  • Adds PowerShell regression coverage.
Show a summary per file
File Description
extensions/git/scripts/powershell/create-new-feature-branch.ps1 Generates and prints the persistent environment assignment.
tests/extensions/git/test_git_extension.py Verifies the corrected hint and removal of old wording.

Review details

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Medium


def test_persist_hint_matches_twins(self, tmp_path: Path):
"""The non-JSON SPECIFY_FEATURE hint must use the '# To persist in your
shell: $env:SPECIFY_FEATURE = '<name>'' form — matching the core

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please address Copilot feedback. If not applicable, please explain why

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.

3 participants