feat: support cloning a single revision - #2824
Draft
Sebastian Thiel (Byron) wants to merge 1 commit into
Draft
Conversation
A full object ID passed through with_ref_name() produced an object-ID refspec mapping and panicked while clone assumed every mapping had a name. Branch and tag checkout also retained ordinary clone tracking semantics instead of offering a single-revision mode. Add PrepareFetch::with_revision() and gix clone --revision for full refs, HEAD, and full object IDs. Revision clones use one source-only implicit refspec, detach HEAD to the fetched commit, create no ordinary refs, persist no fetch refspec, and disable tag following. Existing with_ref_name() and --ref behavior stays unchanged. This follows Git commit 337855629f59 (builtin/clone: teach git-clone(1) the --revision= option) and its t/t5621-clone-revision.sh behavior. Validation: - cargo fmt --all -- --check - cargo test -p gix --features blocking-network-client,blocking-http-transport-curl clone - cargo test -p gitoxide clone_revision_is_distinct_from_ref - cargo check -p gix --no-default-features --features sha1,blocking-network-client,worktree-mutation - cargo check -p gix --no-default-features --features sha1,async-network-client-async-std,worktree-mutation - cargo doc -p gix --no-deps --features blocking-network-client,worktree-mutation
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.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by
Codex GPT-5.Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Fixes #1930
Summary
PrepareFetch::with_revision()for cloningHEAD, a full ref name, or a full object ID into a detached HEAD--revisionoption while preserving the existing--refbehaviorThe behavior follows Git commit
337855629f59and itst/t5621-clone-revision.shcoverage.Validation
cargo fmt --all -- --checkcargo test -p gix --features blocking-network-client,blocking-http-transport-curl clonecargo test -p gitoxide clone_revision_is_distinct_from_refcargo check -p gix --no-default-features --features sha1,blocking-network-client,worktree-mutationcargo check -p gix --no-default-features --features sha1,async-network-client-async-std,worktree-mutationcargo doc -p gix --no-deps --features blocking-network-client,worktree-mutation