Skip to content

fix(push): preserve FETCH_HEAD when refreshing a self-mode checkout - #1936

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
embrace897:embrace897/self-fetch-head
Nov 27, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
embrace897:embrace897/self-fetch-head

Conversation

@embrace897

Copy link
Copy Markdown
Contributor

Summary

Refresh the default remote-tracking branch without writing FETCH_HEAD when preparing a self-mode knowledge worktree on Git 2.29 or newer. Older Git versions continue to use the existing fetch command. The preview can still compare the workspace against current upstream content.

Type of Change

Bug fix.

Test Plan

  • npm run build and npm run typecheck passed on Windows, Node 24.15.0, Git 2.56.0.
  • npx vitest run src/__tests__/dry-run-load-path.test.ts -t "fresh self-mode clone" --retry 0 passed six cases, including the preview with no prior FETCH_HEAD.
  • Ran npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/self-mode-push-behind.test.ts -t "pushes only the member" --retry 0 against the built CLI. The baseline overwrote FETCH_HEAD. The fix preserves the file, updates origin/main, and publishes only the member's new file on a subsequent real push to the local bare remote.
  • Type-aware lint on all three changed files and git diff --check passed.
  • Full lint on Windows still reported the 26 upstream family-facts false positives tracked by fix(lint): resolve family facts imports on Windows #1927.

verify:world requires POSIX. The E2E used the locally built CLI with an isolated HOME and a local Git remote. Git older than 2.29 was not exercised.

Related Issues

Refs #1880 (the self-mode FETCH_HEAD subproblem).

Notes for Reviewers

AI-assisted. The flag is limited to the initial fetch from the business checkout in self mode. The separate default-branch preview paths that read FETCH_HEAD are outside this change.

@embrace897
embrace897 force-pushed the embrace897/self-fetch-head branch from d67eb63 to 9cd17bc Compare November 26, 2026 14:38
@github-actions

Copy link
Copy Markdown

No findings in the specified PR diff.

The PR description documents sufficient testing: a representative built-CLI E2E run reproduces the baseline failure, verifies FETCH_HEAD preservation and origin/main refresh, and confirms the subsequent push publishes only the member’s file. Windows/world and older-Git limitations are explicitly disclosed.

Review was read-only; I did not run, build, or install PR code.

@jeff-r2026 jeff-r2026 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified on Linux (Node 20), stacked on main da482cb together with the other PRs merged in this pass: typecheck, build, lint, the targeted unit suites and the affected E2E files pass. The only failing CI jobs are the two fork-safe E2E jobs that fail on main itself (fixed in #2114).

@jeff-r2026
jeff-r2026 merged commit 5152fc8 into Tencent:main Nov 27, 2026
17 of 20 checks passed
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