Skip to content

Use --filter=blob:none only in promisor repos, shallow fetch otherwise#935

Closed
pjbgf wants to merge 2 commits intomainfrom
pjbgf/entire-remote
Closed

Use --filter=blob:none only in promisor repos, shallow fetch otherwise#935
pjbgf wants to merge 2 commits intomainfrom
pjbgf/entire-remote

Conversation

@pjbgf
Copy link
Copy Markdown
Member

@pjbgf pjbgf commented Apr 13, 2026

Checkpoint fetches previously always used --filter=blob:none, which turns non-promisor repositories into promisor-enabled ones as a side effect. Now we detect whether the repo is already a partial clone (via extensions.partialClone config) and only use treeless fetches in that case. Non-promisor repos use --depth=1 (shallow) instead, or plain fetches where full history is needed for rebase/merge.


Note

Medium Risk
Changes git fetch flags across checkpoint metadata read/push paths based on detected repo type, which can affect how much history/blobs are available and could impact resume/sync behavior in edge cases.

Overview
Stops unconditionally using --filter=blob:none for checkpoint-related fetches so non-partial-clone repos don’t get converted into promisor repos as a side effect.

Adds promisor detection via git config --local extensions.partialClone (cached per process) and centralizes flag selection in PartialCloneFilterArgs*; metadata/v2 fetches now use treeless fetches only for promisor repos and otherwise prefer shallow (--depth=1) or unfiltered fetches where full history is required for rebase/merge.

Updates both origin fetches and checkpoint-remote URL fetches, and adds unit tests covering promisor detection, context-cancellation behavior, and the chosen fetch arguments.

Reviewed by Cursor Bugbot for commit e42c0fe. Configure here.

  Checkpoint fetches previously always used --filter=blob:none, which
  turns non-promisor repositories into promisor-enabled ones as a side
  effect. Now we detect whether the repo is already a partial clone
  (via extensions.partialClone config) and only use treeless fetches
  in that case. Non-promisor repos use --depth=1 (shallow) instead,
  or plain fetches where full history is needed for rebase/merge.

  Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 13, 2026 10:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates checkpoint fetch behavior to avoid unintentionally converting non-partial-clone repositories into promisor (partial clone) repositories. This aligns fetch flags with the repo’s existing configuration by detecting whether the repo is already promisor-enabled and choosing --filter=blob:none only in that case, otherwise using shallow or full fetches as appropriate.

Changes:

  • Add promisor (partial-clone) detection and helper functions to select appropriate git fetch arguments.
  • Update multiple fetch call sites to conditionally use --filter=blob:none only for promisor repos, and shallow fetch otherwise.
  • Add unit tests covering promisor detection and argument selection helpers.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
cmd/entire/cli/strategy/common.go Adds promisor detection + cached result and helper functions to build fetch args.
cmd/entire/cli/strategy/common_test.go Adds tests for promisor detection and fetch-arg helper behavior.
cmd/entire/cli/strategy/push_v2.go Adjusts fetch logic during push conflict recovery to only use blob filtering in promisor repos.
cmd/entire/cli/strategy/push_common.go Adjusts fetch logic for session rebase to only use blob filtering in promisor repos.
cmd/entire/cli/strategy/checkpoint_remote.go Uses new helper to choose fetch flags when fetching from checkpoint remote URLs.
cmd/entire/cli/git_operations.go Switches metadata/v2 fetch helpers to use the new conditional fetch-arg helpers.

…celed contexts

IsPromisorRepo used --get without --local, so a user/global gitconfig
setting could incorrectly mark every repo as promisor. Adding --local
keeps detection scoped to the repository. The sync.Once also cached
false when the first caller's context was already canceled; using
context.WithoutCancel ensures the fast local git-config call always
runs to completion.

Updates doc comments on FetchMetadataBranch, FetchMetadataTreeOnly,
FetchV2MainTreeOnly, FetchV2MainRef, and PartialCloneFilterArgsWithDepth
to accurately reflect the conditional promisor/non-promisor behavior
instead of claiming --filter=blob:none is always used.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Entire-Checkpoint: 9b5bac0a7034
@pjbgf pjbgf marked this pull request as ready for review April 13, 2026 10:38
@pjbgf pjbgf requested a review from a team as a code owner April 13, 2026 10:38
@pjbgf
Copy link
Copy Markdown
Member Author

pjbgf commented Apr 13, 2026

bugbot run

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e42c0fe. Configure here.

fetchCmd := strategy.CheckpointGitCommand(ctx, "origin", "fetch", "--no-tags", "--depth=1", "--filter=blob:none", "origin", refSpec)
args := append([]string{"fetch", "--no-tags"}, strategy.PartialCloneFilterArgsWithDepth(ctx)...)
args = append(args, "origin", refSpec)
fetchCmd := strategy.CheckpointGitCommand(ctx, "origin", args...)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error messages say "treeless" for shallow fetches

Low Severity

FetchMetadataTreeOnly and FetchV2MainTreeOnly now perform a shallow fetch (--depth=1, no --filter) for non-promisor repos, but the error messages still unconditionally say "treeless fetch timed out" and "failed to treeless-fetch". These messages were accurate before this PR (when --filter=blob:none was always used) but are now misleading for the non-promisor code path, which could confuse debugging.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e42c0fe. Configure here.

@pjbgf
Copy link
Copy Markdown
Member Author

pjbgf commented Apr 13, 2026

Closing in favour of #934.

@pjbgf pjbgf closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants