Skip to content

SHA-256 clone and fetch#2584

Open
Sebastian Thiel (Byron) wants to merge 10 commits intomainfrom
improvements
Open

SHA-256 clone and fetch#2584
Sebastian Thiel (Byron) wants to merge 10 commits intomainfrom
improvements

Conversation

@Byron
Copy link
Copy Markdown
Member

Tasks

  • refackiew

Sebastian Thiel (Byron) and others added 5 commits May 7, 2026 22:36
The cargo check MSRV (ubuntu-latest) job failed while compiling gix with default features because gix/src/create.rs directly referenced gix_hash::Kind::Sha256. In the default SHA-1-only feature set, that enum variant is not compiled into gix-hash, producing E0599.

Route object-format config generation through a feature-aware helper so SHA-1-only builds do not name the SHA-256 variant, while builds with sha256 enabled still write extensions.objectFormat = sha256 for SHA-256 repositories.
The test-journey job failed in the SHA-256 clone scenario because the test cloned into ../sha256-clone from inside a temporary sandbox. That resolves to a fixed path in the sandbox parent, so a previous run or shared temp parent can leave the destination non-empty and make clone initialization fail.

Clone into sha256-clone inside the unique sandbox instead, then run the follow-up assertions from that directory.
Comment thread gix/src/create.rs Outdated
@Byron Sebastian Thiel (Byron) marked this pull request as ready for review May 7, 2026 21:30
Copilot AI review requested due to automatic review settings May 7, 2026 21:30
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05a87e5b2d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread gix-protocol/src/command.rs Outdated
Copy link
Copy Markdown

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.

Pull request overview

This PR extends gitoxide’s clone/fetch path to properly negotiate and persist SHA-256 repositories, including client-side protocol v2 object-format handling and repo initialization/configuration for non-SHA1 object formats.

Changes:

  • Add SHA-256 repo initialization support by configuring core.repositoryformatversion and extensions.objectformat.
  • Negotiate object-format as a global v2 capability and plumb the selected hash through fetch/clone/refmap.
  • Add journey + protocol tests and CI recipes to exercise SHA-256 clone behavior and sha1/sha256 feature combinations.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/tools/src/lib.rs Serialize/robustify git-daemon port allocation for journey tests.
tests/journey/gix.sh Add journey coverage for reading and cloning SHA-256 repositories.
tests/helpers.sh Add helper to create a small SHA-256 git repository in a sandbox.
src/plumbing/main.rs Plumb CLI object_hash into clone options.
justfile Expand check/unit-tests to validate sha1/sha256 feature combinations for gix-protocol.
gix/src/create.rs Add object_hash option to init logic; write extensions.objectformat for SHA-256 repos.
gix/Cargo.toml Forward sha1/sha256 feature selection into gix-protocol.
gix-protocol/tests/protocol/fetch/v2.rs Update expected v2 request bytes to include object-format=sha1.
gix-protocol/tests/protocol/fetch/ref_map.rs Add sha256 test ensuring object-format=sha256 is parsed into RefMap.
gix-protocol/tests/protocol/command.rs Add tests asserting object-format is emitted as a global v2 capability.
gix-protocol/src/lib.rs Enforce selecting sha1 or sha256 via compile-time error.
gix-protocol/src/fetch/refmap/init.rs Determine object hash from capabilities and use it consistently in refmap init.
gix-protocol/src/command.rs Emit object-format as a global v2 feature and allow it during validation.
gitoxide-core/src/repository/clone.rs Initialize cloned repositories using the requested object_hash.

Comment thread gix/src/create.rs
Comment thread gix-protocol/src/command.rs Outdated
Review comments addressed:
- `repositoryformatversion` was written as `0` for SHA-1 repositories. This now omits repository format configuration for the default hash and only writes version `1` plus `extensions.objectformat` for SHA-256.
- V0/V1 fetch negotiation only advertised standard fetch capabilities. This now echoes the server-advertised `object-format` capability for fetch across V0, V1, and V2.
- `object_format_feature()` allocated for known object formats. This now borrows the known `sha1` and `sha256` values and only allocates for unknown values.

Tests cover SHA-1/SHA-256 init config, V0/V1 object-format negotiation, borrowed object-format values, and serialized V1 fetch requests.
Copilot AI review requested due to automatic review settings May 7, 2026 22:20
Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Comment thread justfile Outdated
Comment thread gix/tests/gix/init.rs
Sebastian Thiel (Byron) and others added 2 commits May 8, 2026 06:47
Keep gix-protocol unit-test invocations on the existing SHA-1 fixtures by enabling sha1 alongside sha256, and gate the default-object-hash init assertion to sha1 builds.
Copilot AI review requested due to automatic review settings May 8, 2026 00:18
Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Comment thread tests/tools/src/lib.rs Outdated
Comment thread src/plumbing/options/mod.rs
Comment thread gitoxide-core/src/repository/dirwalk.rs
Comment thread gix/src/create.rs
The git-daemon readiness loop could wait forever while holding the port-allocation lock if the child stayed alive but never accepted connections. Bound each startup attempt to ten seconds and preserve the last connection error before trying another port.

The new dirwalk plumbing command lacked journey coverage. Add journey tests for the default invocation, matching untracked mode, and statistics output.
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.

4 participants