fix(bundle-recovery): gate --filter=blob:none on shallow or sparse checkouts#35766
Merged
Conversation
…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.
Contributor
|
✅ smoke-ci: safeoutputs CLI comment + comment-memory run (26654349383)
|
Contributor
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(bundle-recovery): gate --filter=blob:none on shallow or sparse checkouts
Summary
Gates the
--filter=blob:noneflag on prerequisite commit fetches so it is only applied when the local repository is in a shallow or sparse-checkout state. Previously,--filter=blob:nonewas applied unconditionally, which could cause bundle-recovery failures on full clones that do not support or benefit from blob filtering.Problem
--filter=blob:nonewas 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
isShallowOrSparseCheckouthelper ingit_helpers.cjsthat probes the local git repository to determine whether it is a shallow clone or has sparse-checkout enabled. Bothcreate_pull_request.cjsandpush_to_pull_request_branch.cjsnow call this helper and only append--filter=blob:nonewhen warranted.Changes
actions/setup/js/git_helpers.cjsisShallowOrSparseCheckout, which probes the repo for shallow or sparse-checkout stateactions/setup/js/create_pull_request.cjsisShallowOrSparseCheckoutand conditionally applies--filter=blob:noneto prerequisite fetchesactions/setup/js/push_to_pull_request_branch.cjs--filter=blob:nonelogic ascreate_pull_request.cjsactions/setup/js/git_helpers.test.cjsisShallowOrSparseCheckoutcovering shallow, sparse, full-clone, error, and case-insensitive casesactions/setup/js/create_pull_request.test.cjsargs.includesinstead of positional checksactions/setup/js/push_to_pull_request_branch.test.cjs--filter=blob:noneis expected in the full-clone scenarioImpact Assessment
git_helpers.cjs,create_pull_request.cjs,push_to_pull_request_branch.cjsTesting
isShallowOrSparseCheckoutcovering all relevant states (shallow, sparse, full clone, error path, case-insensitive git output)--filter=blob:noneis absent in full-clone scenarios and present in shallow/sparse scenarios