Skip to content

fix: initial branch missing prefix#5

Merged
skarim merged 4 commits intomainfrom
skarim/fix-initial-branch-prefix
Mar 25, 2026
Merged

fix: initial branch missing prefix#5
skarim merged 4 commits intomainfrom
skarim/fix-initial-branch-prefix

Conversation

@skarim
Copy link
Copy Markdown
Collaborator

@skarim skarim commented Mar 25, 2026

Fixes a bug that wasn't applying prefixes to the first branch in a stack if the prefix was explicitly passed in via args to init
ex: gh stack init -p prefix suffix -> created a branch called suffix, not prefix/suffix as expected

Updated the initialization logic to ensure that when a branch prefix is specified, it is properly applied to explicitly named branches during stack creation. Also added a test to verify this behavior.

Copilot AI review requested due to automatic review settings March 25, 2026 19:16
Copy link
Copy Markdown

Copilot AI left a comment

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 updates gh stack init so that when users pass explicit branch names along with --prefix, the prefix is applied to those branch names (matching the behavior users get in interactive flows), and adds a regression test to cover the new behavior.

Changes:

  • Apply --prefix to explicitly provided branch arguments during init.
  • Store the prefixed branch names in the stack file when initializing from explicit branches.
  • Add a unit test verifying prefixed branch creation + persisted stack state.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cmd/init.go Prefix explicit branch args before branch existence checks / creation and before persisting stack branches.
cmd/init_test.go Adds coverage asserting created branches and persisted stack branches include the prefix.

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

Comment thread cmd/init.go
Copy link
Copy Markdown

Copilot AI commented Mar 25, 2026

Warning

This is an internal experiment to assess Copilot's ability to auto-approve PRs. Please 👍 this comment if the assessment below is correct and 👎 if not. Feedback in #f-ccr-auto-approve is appreciated!

Copilot thinks this PR is not ready to approve — see review comments for details.

Copy link
Copy Markdown

Copilot AI left a comment

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 updates gh stack init to handle stack prefixes more consistently by prompting/validating the prefix earlier and applying it to explicitly provided branch arguments, with added tests to cover the new behavior.

Changes:

  • Prompt for --prefix earlier in interactive init flows and validate the prefix before any branch creation.
  • Apply --prefix to explicitly provided branch arguments (gh stack init --prefix X b1 b2 creates X/b1, X/b2).
  • Add tests verifying prefix application to explicit branches and that invalid prefixes are rejected before branch creation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
cmd/init.go Adds early interactive prefix prompting + prefix validation; applies prefix to explicit branch args before creation.
cmd/init_test.go Adds coverage for prefixed explicit branches and early invalid-prefix rejection.

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

Comment thread cmd/init.go
Comment thread cmd/init.go
Comment thread cmd/init_test.go
Comment thread cmd/init.go
Copy link
Copy Markdown

Copilot AI commented Mar 25, 2026

Warning

This is an internal experiment to assess Copilot's ability to auto-approve PRs. Please 👍 this comment if the assessment below is correct and 👎 if not. Feedback in #f-ccr-auto-approve is appreciated!

Copilot thinks this PR is not ready to approve — see review comments for details.

@skarim skarim merged commit e7fdf6d into main Mar 25, 2026
7 checks passed
@skarim skarim deleted the skarim/fix-initial-branch-prefix branch March 25, 2026 21:33
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.

2 participants