Skip to content

[pull] trunk from cli:trunk - #224

Merged
pull[bot] merged 24 commits into
arc675:trunkfrom
cli:trunk
Aug 21, 2026
Merged

[pull] trunk from cli:trunk#224
pull[bot] merged 24 commits into
arc675:trunkfrom
cli:trunk

Conversation

@pull

@pull pull Bot commented Aug 21, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

tidy-dev and others added 24 commits July 29, 2026 10:14
Rework the local-cleanup half of --delete-branch to handle git worktrees:

Scenario 1 - cwd is the PR head worktree: skip local cleanup entirely
and print a warning with manual cleanup instructions, since we cannot
safely check out another branch or remove the worktree we are standing
inside.

Scenario 2 - cwd is not the PR head worktree but a sibling worktree has
the branch: remove that worktree via git worktree remove, then delete
the branch ref. If removal fails (e.g. dirty worktree), warn and skip
rather than exiting non-zero after a successful merge.

The conventional single-working-directory path (no worktrees) is
unchanged. Remote branch deletion proceeds normally in all cases.

Also adds git.Client.WorktreeRemove() helper.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Guard against git branch -D failing when the PR head branch is checked
out in the main worktree while running from a different worktree. Warn
and skip local delete instead of exiting non-zero on local cleanup.

Also add unit tests for parseWorktrees and simplify its record parsing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
When deleting the PR head branch requires checking out the base branch,
git fails if the base branch is checked out in another worktree. Detect
that case and warn+skip local delete instead of exiting non-zero, and
fix an unrealistic worktree fixture in the no-conflict test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Collapse the five per-scenario worktree deleteBranch tests into a single
table-driven test with named subtests, matching the AGENTS.md testing
guidance and removing repeated setup boilerplate.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Trunk migrated BranchDeleteRemote to safeurl.JoinPath, which escapes the
branch ref's slash (heads%2Ffeature). Update the new worktree test stubs
to match the encoded path so httpmock.REST matches after merging trunk.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The len(worktrees) > 0 guard was always true since Worktrees() always
lists at least the main worktree. Reuse the existing isInLinkedWorktree
predicate instead, which already implies len > 1 (keeping worktrees[0]
access safe) and folds in the path comparison. Behavior is unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Teach gh issue develop to accept --worktree <path> together with --checkout, allowing a linked development branch to be checked out in a new Git worktree without changing the branch in the caller's current working tree.

Validate that --worktree is non-empty, requires --checkout, and cannot be combined with --list. Resolve relative targets to absolute paths before invoking Git so later worktree-local operations use one stable path while paths containing spaces remain valid.

Add git.Client.AddWorktree to handle both supported branch states. Existing local branches use git worktree add and are then fast-forwarded with git -C <worktree> pull --ff-only. Missing local branches are created in the worktree as tracking branches from the remote selected for the linked branch repository, including --branch-repo workflows.

Keep the existing checkout behavior unchanged when --worktree is absent, and let git worktree add surface native errors for occupied paths or branches already checked out elsewhere.

Cover flag parsing and validation, relative and spaced paths, existing and new local branches, cross-repository remote selection, command construction, and Git error propagation.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Detect the invoking agent once during startup and reuse the result for IOStreams, telemetry, and command factory initialization. Prefer text progress indicators for agents while preserving GH_SPINNER_DISABLED as the explicit override.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: edd6fa49-4788-4882-93f6-ca7caca4b7ed
Isolate spinner precedence tests from inherited environment overrides and verify startup propagation of agent detection through telemetry in the acceptance suite.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: edd6fa49-4788-4882-93f6-ca7caca4b7ed
Classify local branch cleanup by where the PR head is checked out, and skip cleanup safely when worktree discovery fails.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Match the Worktree model to Git's fully qualified ref terminology.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ree-guards

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 19c04729-87af-4473-88bb-a263d66b20f1
Extract worktree target validation and branch placement so issue develop inherits pr checkout safety and reuse behavior. Add unit and acceptance coverage for fresh, reused, and cross-repository worktrees.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 2ce1b530-30dc-47e3-9c30-392f1368ddd8
Protect issue develop's existing nonfatal fast-forward behavior when reusing a linked worktree.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2ce1b530-30dc-47e3-9c30-392f1368ddd8
Adapt spinner output for invoking agents
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 19c04729-87af-4473-88bb-a263d66b20f1
Guard `pr merge --delete-branch` against worktree conflicts
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2ce1b530-30dc-47e3-9c30-392f1368ddd8
Add worktree checkout to `gh issue develop`
@pull pull Bot locked and limited conversation to collaborators Aug 21, 2026
@pull pull Bot added the ⤵️ pull label Aug 21, 2026
@pull
pull Bot merged commit 62e3e71 into arc675:trunk Aug 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants