fix(worktree): track explicit remote-only branch (#31645)

* fix(worktree): track explicit remote branch

* test(worktree): cover remote branch path retry

* fix(worktree): resolve cached remote branches canonically

* fix(git): retain commit validation in bounded ref probes

* fix(worktree): preserve selected remote identity during creation

* test(worktree): count cached resolver Git work during path retries

* Fix branch intent state in composer source fixture

* Make Git and daemon regression fixtures portable

* Use the selected base for existing branch creation

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
This commit is contained in:
Pr1p
2026-10-26 13:13:56 -07:00
committed by GitHub
co-authored by Brennan Benson
parent 161927f562
commit fdcf193cd4
30 changed files with 434 additions and 73 deletions
@@ -78,6 +78,9 @@ it('tracks the remote branch it was created from, and nothing else', async () =>
const fixPath = join(root, 'fix')
await addWorktree(repo, fixPath, 'alex/fix', 'origin/alex/fix')
expect(await upstreamOf(fixPath, 'alex/fix')).toBe('origin/alex/fix')
const ref = 'refs/remotes/origin/alex/fix'
expect(await git(fixPath, 'config', '--get', 'branch.alex/fix.base')).toBe(ref)
expect(await git(fixPath, 'config', '--get', 'push.autoSetupRemote')).toBe('true')
expect(await git(fixPath, 'rev-parse', 'HEAD')).toBe(
await git(repo, 'rev-parse', 'refs/remotes/origin/alex/fix')
)
@@ -112,4 +115,10 @@ it('tracks the remote branch when a prepared checkout finalizes the create', asy
prepared.lockReason
)
expect(await upstreamOf(fixPath, 'alex/fix')).toBe('origin/alex/fix')
const ref = 'refs/remotes/origin/alex/fix'
expect(await git(fixPath, 'config', '--get', 'branch.alex/fix.base')).toBe(ref)
expect(await git(fixPath, 'config', '--get', 'push.autoSetupRemote')).toBe('true')
expect(await git(fixPath, 'rev-parse', 'HEAD')).toBe(
await git(repo, 'rev-parse', 'refs/remotes/origin/alex/fix')
)
})