Use --filter=blob:none only in promisor repos, shallow fetch otherwise#935
Use --filter=blob:none only in promisor repos, shallow fetch otherwise#935
Conversation
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>
There was a problem hiding this comment.
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 fetcharguments. - Update multiple fetch call sites to conditionally use
--filter=blob:noneonly 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
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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...) |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit e42c0fe. Configure here.
|
Closing in favour of #934. |


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 (viaextensions.partialCloneconfig) 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 fetchflags 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:nonefor 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 inPartialCloneFilterArgs*; 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.