Skip to content

fix(bundle-recovery): gate --filter=blob:none on shallow or sparse checkouts#35766

Merged
dsyme merged 1 commit into
mainfrom
dsyme/gate-blob-filter-on-shallow-or-sparse
May 29, 2026
Merged

fix(bundle-recovery): gate --filter=blob:none on shallow or sparse checkouts#35766
dsyme merged 1 commit into
mainfrom
dsyme/gate-blob-filter-on-shallow-or-sparse

Conversation

@dsyme
Copy link
Copy Markdown
Collaborator

@dsyme dsyme commented May 29, 2026

fix(bundle-recovery): gate --filter=blob:none on shallow or sparse checkouts

Summary

Gates the --filter=blob:none flag on prerequisite commit fetches so it is only applied when the local repository is in a shallow or sparse-checkout state. Previously, --filter=blob:none was applied unconditionally, which could cause bundle-recovery failures on full clones that do not support or benefit from blob filtering.

Problem

--filter=blob:none was passed to all prerequisite commit fetches regardless of the repository's checkout state. On full clones, this flag is unnecessary and can trigger unexpected fetch behaviour or errors during bundle recovery.

Solution

Introduces an isShallowOrSparseCheckout helper in git_helpers.cjs that probes the local git repository to determine whether it is a shallow clone or has sparse-checkout enabled. Both create_pull_request.cjs and push_to_pull_request_branch.cjs now call this helper and only append --filter=blob:none when warranted.

Changes

File Type Description
actions/setup/js/git_helpers.cjs Modified Added and exported isShallowOrSparseCheckout, which probes the repo for shallow or sparse-checkout state
actions/setup/js/create_pull_request.cjs Modified Calls isShallowOrSparseCheckout and conditionally applies --filter=blob:none to prerequisite fetches
actions/setup/js/push_to_pull_request_branch.cjs Modified Same conditional --filter=blob:none logic as create_pull_request.cjs
actions/setup/js/git_helpers.test.cjs Modified Full test suite for isShallowOrSparseCheckout covering shallow, sparse, full-clone, error, and case-insensitive cases
actions/setup/js/create_pull_request.test.cjs Modified Updated assertions for new conditional fetch behaviour; loosened mock guard to use args.includes instead of positional checks
actions/setup/js/push_to_pull_request_branch.test.cjs Modified Updated test comment to clarify no --filter=blob:none is expected in the full-clone scenario

Impact Assessment

  • Breaking change: No
  • High-impact files: git_helpers.cjs, create_pull_request.cjs, push_to_pull_request_branch.cjs
  • Risk: Low — behaviour is unchanged for shallow/sparse checkouts; full clones now skip the flag they should never have received

Testing

  • New unit tests added for isShallowOrSparseCheckout covering all relevant states (shallow, sparse, full clone, error path, case-insensitive git output)
  • Existing tests updated to assert that --filter=blob:none is absent in full-clone scenarios and present in shallow/sparse scenarios

Generated by PR Description Updater for issue #35766 · sonnet46 1.2M ·

…eckouts

The recently-added --filter=blob:none on bundle prerequisite-recovery
fetches in create_pull_request.cjs and push_to_pull_request_branch.cjs
would convert a full clone into a partial clone, causing subsequent git
operations to lazily re-fetch blobs over the network.

Only apply --filter=blob:none when the local repository is already
shallow (`git rev-parse --is-shallow-repository` == true) or has
sparse-checkout enabled (`git config core.sparseCheckout` == true), in
which case partial-object availability is already accepted and blob
filtering is consistent.

Adds isShallowOrSparseCheckout() helper in git_helpers.cjs with unit
tests, and updates existing recovery tests to reflect the gating.
Copilot AI review requested due to automatic review settings May 29, 2026 18:16
@github-actions
Copy link
Copy Markdown
Contributor

✅ smoke-ci: safeoutputs CLI comment + comment-memory run (26654349383)

Generated by 🧪 Smoke CI for issue #35766 ·

@github-actions
Copy link
Copy Markdown
Contributor

Comment Memory

CI lights the path
Green checks bloom at dawn
Quiet bots still sing

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

Generated by 🧪 Smoke CI for issue #35766 ·

@dsyme dsyme merged commit 166eb11 into main May 29, 2026
26 of 27 checks passed
@dsyme dsyme deleted the dsyme/gate-blob-filter-on-shallow-or-sparse branch May 29, 2026 18:20
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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