Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Automatically pull can fast-forward a feature branch during a checkout switch #48095

Openmagrathean-uk(GitHub profile, opens in a new tab) opened this issue 0 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Create a disposable checkout with clean local branches main (the default) and feature at the same commit. Set both to track their respective branches on origin. Advance each branch on origin by one commit with a different edit, then fetch in the checkout.
  2. With main checked out and Automatically pull enabled, the server finds it clean and one commit behind. It passes the checkout directory to the pull driver. Pause after the driver's git rev-parse HEAD preflight and before it starts git pull --ff-only. Eligibility check and pull call · Git driver
  3. In that gap, run git switch feature, then let the pull proceed. The transcript below comes from a disposable Git fixture that inserts this switch at the same point in the command sequence. App scheduling was not exercised.

Expected behavior

The automatic pull skips the checkout after the switch. Both local branch tips stay where they were.

Actual behavior

Git fast-forwards feature and updates its files. main stays behind. The driver's success path compares the before and after HEAD commits and reports pulled with the branch name read before the switch.

#39914 and #43077 concern when the default checkout is visited. #47502 guards pull request worktree refresh. Background pull still starts a separate git pull --ff-only after checking the branch.

Carry the expected branch and commit through the background pull, fetch its upstream, then check the branch and commit under the index lock before applying the fast-forward. The worktree refresh in #47502 already uses that guard.

Impact

Minor bug or occasional failure

Version or commit

main @ ddc72ec5c9 (source inspected)

Environment

Command-level reproduction on macOS with Git 2.56.1 and Node 26.13.1.

Logs or stack traces

Eligible checkout: main, clean, 0 ahead, 1 behind
Pull preflight read: branch=main upstream=refs/remotes/origin/main HEAD=dfb7941
Concurrent checkout: feature
Fast-forward
main changed: false
feature changed: true
checked-out content: upstream updated feature

Workaround

Turn off Automatically pull for the project.

Found by reading the source and reproduced at the Git command level with GPT-6.2 Sol in Codex CLI; the app itself was not run.

  1. tanstack-source added labelsbug

Sign in to join this conversation.