Skip to content

Put a new stack in the worktree's own stack file - #49

Merged
DomBlack merged 1 commit into
mainfrom
dom/new-stack-in-worktree-file
Oct 16, 2026
Merged

DomBlack merged 1 commit into
mainfrom
dom/new-stack-in-worktree-file

Conversation

@DomBlack

@DomBlack DomBlack commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

gh stack keeps a separate stack file per worktree and only ever reads the one for the worktree it runs in. When git stack init (or a move onto a trunk) started a new stack in a linked worktree that didn't have a file yet, we wrote it into the main checkout's file instead. git-stack reads every worktree's file so view and sync looked fine, but submit from that worktree failed with "current branch is not part of a stack". That's how I hit it submitting #48.

New stacks now always go in the current worktree's file, creating it if need be, and that's the git dir we lock while writing. From the main checkout nothing changes, since its git dir is the common one.

Copilot AI balanced review requested due to automatic review settings October 16, 2026 12:17
@DomBlack
DomBlack added this pull request to stack #51 October 16, 2026 12:17
@DomBlack DomBlack added the bug Something isn't working label Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Running git stack init in a linked worktree that didn't have a stack file yet wrote the new stack into the main checkout's file. git-stack reads every worktree's file so it all looked fine, but gh stack only reads the file in the git dir it runs in, so from that worktree submit said the branch wasn't in a stack. Anything else that starts a new stack the same way (move onto a trunk) hit it too.

New stacks now always go in the current worktree's file, creating it if need be, and that's the git dir we lock while writing. From the main checkout nothing changes, since its git dir is the common one.
@DomBlack
DomBlack force-pushed the dom/new-stack-in-worktree-file branch from adc55fb to 1938ee0 Compare October 16, 2026 12:18
@DomBlack
DomBlack merged commit 1ac293d into main Oct 16, 2026
5 checks passed
@DomBlack
DomBlack deleted the dom/new-stack-in-worktree-file branch October 16, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants