UPSTREAM PR #2375: feat: filters and partial cloning: initial support#13
Open
UPSTREAM PR #2375: feat: filters and partial cloning: initial support#13
Conversation
Introduce `gix::remote::fetch::ObjectFilter` (currently blob filters only) and plumb it through clone/fetch all the way into the fetch protocol, returning a clear error if the remote doesn’t advertise `filter` capability. Also persist the partial-clone configuration on clone (`remote.<name>.partialclonefilter`, `remote.<name>.promisor`, `extensions.partialclone`) so the repository is marked as a promisor/partial clone in the same way as Git. On the CLI/plumbing side, add `--filter <spec>` to `gix clone`, and allow fetch arguments to be either refspecs or raw object IDs (treated as additional wants). Includes tests for filter parsing and for persisting partial-clone settings during clone. Creates a blobless bare clone using `gix`, creates (using real `git`) a worktree from that, and then using `gix` verify that `--filter=blob:none` is working! Credit: - Original work by Cameron Esfahani <cesfahani@roku.com> - Rewritten for modern Gitoxide by Jake Staehle <jstaehle@roku.com> [Upstream-Status: Appropriate for OSS Release]
…t to avoid the network. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1fdf406 to
2c60401
Compare
10e213a to
3c9dbbe
Compare
dccca45 to
24496b3
Compare
f045646 to
e746ced
Compare
3a9c4ae to
a28c634
Compare
3deba97 to
9b41e5f
Compare
95ef755 to
a9e7940
Compare
8b02847 to
1bf0519
Compare
cdbe120 to
78a7ab5
Compare
efe2b63 to
51a12b8
Compare
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.
Mirrored from GitoxideLabs/gitoxide#2375
Resolves #1046
Hi @Byron! I'm Jake Staehle and I work at Roku here with @cesfahani. We've had an internal version of this for our internal tools for quite some time, but I recently updated our
gitoxideversion to0.49and had to refactor this code myself for all the changes since0.40-- I would very much rather not do that again, so it's upstreaming time :)Introduce
gix::remote::fetch::ObjectFilter(currently blob filters only) and plumb it through clone/fetch all the way into the fetch protocol, returning a clear error if the remote doesn’t advertisefiltercapability.Also persist the partial-clone configuration on clone (
remote.<name>.partialclonefilter,remote.<name>.promisor,extensions.partialclone) so the repository is marked as a promisor/partial clone in the same way as Git.On the CLI/plumbing side, add
--filter <spec>togix clone, and allow fetch arguments to be either refspecs or raw object IDs (treated as additional wants).Includes tests for filter parsing and for persisting partial-clone settings during clone, as well as a full round-trip test creating a blobless bare clone using
gix, creating (using realgit) a worktree from that, and then usinggixverify that--filter=blob:noneis working!I did create a new repo https://github.com/staehle/gitoxide-testing for that last test to work properly, with a small set of known commits, tags, and blob objects. If you think this is useful, I'd be glad to transfer the repo to you / the
GitoxideLabsgroup!Let me know what you think! Thanks!
Credit: