Skip to content

Use GIX_TEST_FIXTURE_HASH for gix-worktree-stream#2543

Merged
Sebastian Thiel (Byron) merged 11 commits into
GitoxideLabs:mainfrom
cruessler:run-gix-worktree-stream-tests-with-sha-256
Apr 29, 2026
Merged

Use GIX_TEST_FIXTURE_HASH for gix-worktree-stream#2543
Sebastian Thiel (Byron) merged 11 commits into
GitoxideLabs:mainfrom
cruessler:run-gix-worktree-stream-tests-with-sha-256

Conversation

@cruessler
Copy link
Copy Markdown
Contributor

@cruessler Christoph Rüßler (cruessler) commented Apr 24, 2026

CI failed with the following error message:

error: failed to select a version for the requirement `gix-hash = "^0.23.0"`
candidate versions found which didn't match: 0.24.0
location searched: /home/runner/work/gitoxide/gitoxide/gix-hash
required by package `gix-worktree-stream v0.31.0 (/home/runner/work/gitoxide/gitoxide/gix-worktree-stream)`

This is odd as, in this PR, gix-worktree-stream is only at version 0.30.0.

Open questions

  • Are the additions to byte_to_hash and hash_to_byte correct?
  • In TryFrom<&super::Store> for super::Store, do we want to replace use_multi_pack_index: false by use_multi_pack_index: s.use_multi_pack_index?

This is part of #281

@cruessler Christoph Rüßler (cruessler) force-pushed the run-gix-worktree-stream-tests-with-sha-256 branch from 7605705 to 74a08aa Compare April 27, 2026 17:34
This is breaking because `Stream::add_entry_from_path`'s API has
changed. It now takes `hash_kind` as an argument.
`gix-worktree-stream` actually has `#[cfg(feature = "sha256")]` in two
places.
@Byron
Copy link
Copy Markdown
Member

Sebastian Thiel (Byron) commented Apr 29, 2026

Thanks a lot for keeping this up, and as always sorry for the delays.

While reviewing I noticed one thing that I think we should change from now on: unless the context really demands it, let's use object_hash as variable name for the hash kind. It's used in many other places already and it's feels more descriptive than hash_kind.

I have pushed a couple of commits on top to change this, after I rebased yours for good measure. And… let's merge this :), and follow up anything else in the next PR.

PS

This is the first time my new review workflow actually worked flawlessly :)! It's a delight.

  • create a stacked-git stack of the commits to review
  • stg pop --all to get to the forkpoint
  • git checkout $(stg id <topmost-patch>) -- . && git read-tree @
    • now all changes are visible as changed files
  • stg new review to get a 'container' for possible review changes
  • in Zed, review every hunk and stage every hunk
    • Make changes in place as needed, right there on hunk level
    • stg refresh --index to put reviewed hunks into the review commit, and take them 'off the list'
  • git rev-parse @ to see the commit hash of the review + changes = $review_commit
  • stg delete 0 to remove the review commit from the patch queue
  • stg push --all to get back to the top
  • gix merge tree @ @ $review_commit --message "review" --update-head
    • the secret sauce, it's a cherry-pick of just the changes that came up during the review
  • git diff to see all the changes one last time - they are also in the commit but we didn't update the worktree with gix
  • git checkout -f HEAD to let the worktree match the review commit
  • git push

Quite a few steps, but it's a great demonstration of how useful the Git index actually is.

Q & A

error: failed to select a version for the requirement gix-hash = "^0.23.0"

It's the version field in the dev-dependencies, which must not be used there. Having it would also prevent me to publish, so it's good it shows up in this way too, it's easy to overlook (also in the review!).

  • Are the additions to byte_to_hash and hash_to_byte correct?

I think so!

  • In TryFrom<&super::Store> for super::Store, do we want to replace use_multi_pack_index: false by use_multi_pack_index: s.use_multi_pack_index?

Good catch, this looks like an oversight.

@Byron Sebastian Thiel (Byron) force-pushed the run-gix-worktree-stream-tests-with-sha-256 branch from 9245578 to d5a5a76 Compare April 29, 2026 22:18
@Byron Sebastian Thiel (Byron) marked this pull request as ready for review April 29, 2026 22:34
Copilot AI review requested due to automatic review settings April 29, 2026 22:34
@Byron Sebastian Thiel (Byron) force-pushed the run-gix-worktree-stream-tests-with-sha-256 branch from 2cf977b to 4309fa4 Compare April 29, 2026 22:36
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: 2cf977bc93

ℹ️ 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-worktree-stream/Cargo.toml
Comment thread gix-worktree-stream/tests/stream.rs
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

Updates the workspace to consistently respect GIX_TEST_FIXTURE_HASH (SHA1 vs SHA256) in fixtures and tests, while renaming hash_kindobject_hash across gix_object::Data and related call sites, and extending gix-worktree-stream to encode/decode the selected object-hash kind.

Changes:

  • Add gix_testtools::object_hash() / object_hash_from_env() and migrate call sites from the previous env-based helper usage.
  • Rename gix_object::Data field hash_kind to object_hash and propagate the rename through multiple crates, tests, and benches.
  • Add SHA256 signaling to gix-worktree-stream’s protocol and run its tests for both hash kinds via just.

Reviewed changes

Copilot reviewed 63 out of 63 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/tools/src/lib.rs Introduces object_hash() helpers and uses them for fixture generation paths and GIT_DEFAULT_HASH.
justfile Adds dual-hash nextest runs for gix-worktree-stream.
gix/src/repository/impls.rs Updates gix_object::Data construction to use object_hash.
gix-worktree-stream/tests/stream.rs Makes expectations hash-kind aware; updates ODB init to use selected object hash.
gix-worktree-stream/src/protocol.rs Adds byte mapping for SHA256 in the stream protocol (feature-gated).
gix-worktree-stream/src/lib.rs Changes add_entry_from_path() to accept an object_hash kind and use it for null IDs.
gix-worktree-stream/Cargo.toml Adds a sha256 feature and enables SHA256 for dev tests via gix-hash dev-dep features.
gix-revwalk/src/graph/mod.rs Renames LazyCommit field hash_kindobject_hash.
gix-revwalk/src/graph/commit.rs Propagates object_hash rename into commit parsing paths.
gix-refspec/tests/refspec/match_group.rs Switches hash selection to gix_testtools::object_hash().
gix-ref/tests/refs/main.rs Uses gix_testtools::object_hash() for fixture hash kind.
gix-ref/tests/refs/file/mod.rs Updates gix_object::Data field name to object_hash.
gix-ref/src/store/packed/transaction.rs Updates gix_object::Data field name to object_hash.
gix-ref/src/store/packed/mod.rs Renames packed-refs parsing state field to object_hash.
gix-ref/src/store/packed/iter.rs Propagates object_hash rename through packed-refs iteration/parsing.
gix-ref/src/store/packed/find.rs Uses object_hash when decoding packed references.
gix-ref/src/store/packed/decode.rs Renames decode parameter to object_hash and updates callers.
gix-ref/src/store/packed/buffer.rs Renames packed buffer field/params to object_hash.
gix-ref/src/store/file/raw_ext.rs Adjusts destructuring to object_hash field rename.
gix-ref/src/store/file/overlay_iter.rs Renames iterator field to object_hash and updates decoding call.
gix-ref/src/store/file/loose/reference/decode.rs Renames loose-ref parsing arg to object_hash.
gix-ref/src/parse.rs Renames hex_hash() arg to object_hash for consistency.
gix-pack/tests/pack/data/input.rs Updates gix_object::Data field and fixture hash selection.
gix-pack/src/data/output/count/objects/mod.rs Uses obj.object_hash when parsing tags/commits/trees.
gix-pack/src/bundle/find.rs Updates gix_object::Data field name to object_hash.
gix-odb/src/store_impls/loose/find.rs Updates gix_object::Data field name to object_hash.
gix-odb/src/store_impls/dynamic/handle.rs Preserves store object_hash in TryFrom<&Store> for Store.
gix-odb/src/store_impls/dynamic/find.rs Updates gix_object::Data field name to object_hash.
gix-odb/src/memory.rs Updates gix_object::Data field name to object_hash.
gix-object/tests/object/tree/iter.rs Uses gix_testtools::object_hash() for parsing tree entries.
gix-object/tests/object/tree/from_bytes.rs Uses gix_testtools::object_hash() in tree parsing tests.
gix-object/tests/object/tree/entries.rs Uses gix_testtools::object_hash() in tree ordering test.
gix-object/tests/object/tree/editor.rs Updates gix_object::Data field name to object_hash.
gix-object/tests/object/object_ref.rs Uses gix_testtools::object_hash() in loose object parsing test.
gix-object/tests/object/main.rs Uses gix_testtools::object_hash() for fixture hash kind.
gix-object/tests/object/encode.rs Uses gix_testtools::object_hash() for roundtrip parsing.
gix-object/src/tree/ref_iter.rs Uses tree.object_hash when iterating tree components.
gix-object/src/tag/ref_iter.rs Updates docs to refer to object_hash.
gix-object/src/tag/decode.rs Updates docs to refer to object_hash.
gix-object/src/parse.rs Updates docs to refer to object_hash.
gix-object/src/object/mod.rs Updates docs to refer to object_hash.
gix-object/src/lib.rs Renames Data.hash_kindData.object_hash and updates docs.
gix-object/src/data.rs Updates Data decoding to use self.object_hash.
gix-object/src/commit/ref_iter.rs Updates docs to refer to object_hash.
gix-object/src/commit/mod.rs Renames CommitRef::from_bytes arg to object_hash and threads it through decode.
gix-object/src/commit/decode.rs Updates commit parsing to use the renamed hash-kind parameter.
gix-object/benches/edit_tree.rs Updates gix_object::Data field name to object_hash.
gix-object/benches/decode_objects.rs Uses gix_testtools::object_hash() in benchmark setup.
gix-merge/tests/merge/blob/mod.rs Updates gix_object::Data field name to object_hash.
gix-index/src/extension/end_of_index_entry/write.rs Renames function arg to object_hash and updates uses.
gix-filter/tests/filter/pipeline/mod.rs Uses gix_testtools::object_hash() in filter pipeline options.
gix-filter/tests/filter/pipeline/convert_to_worktree.rs Uses gix_testtools::object_hash() in expected-hash assertions.
gix-filter/tests/filter/pipeline/convert_to_git.rs Uses gix_testtools::object_hash() in expected-hash assertions.
gix-filter/tests/filter/ident.rs Uses gix_testtools::object_hash() throughout ident tests.
gix-diff/tests/diff/tree_with_rewrites.rs Uses gix_testtools::object_hash() for tree parsing and fixtures.
gix-diff/tests/diff/main.rs Uses gix_testtools::object_hash() for ID selection and fixture kind.
gix-diff/src/tree/function.rs Uses gix_testtools::object_hash().null() in tests.
gix-blame/tests/blame.rs Uses gix_testtools::object_hash() for fixture kind.
gix-archive/tests/archive.rs Updates add_entry_from_path() calls to pass object_hash.
gitoxide-core/src/repository/archive.rs Passes repo.object_hash() into add_entry_from_path().
gitoxide-core/src/query/engine/update.rs Uses obj.object_hash when parsing commit parents.
gitoxide-core/src/index/checkout.rs Updates gix::objs::Data field name to object_hash.
gitoxide-core/src/hours/mod.rs Renames commit parsing arg to object_hash and threads it through.

Comment thread gix-worktree-stream/Cargo.toml
Comment thread gix-object/src/commit/decode.rs Outdated
Comment thread gix-worktree-stream/tests/stream.rs
Comment thread gix-odb/src/store_impls/dynamic/handle.rs
Comment thread gix-worktree-stream/src/protocol.rs
Comment thread gix-worktree-stream/src/protocol.rs
Copilot AI review requested due to automatic review settings April 29, 2026 22:54
@Byron Sebastian Thiel (Byron) force-pushed the run-gix-worktree-stream-tests-with-sha-256 branch from 18bb074 to b358d31 Compare April 29, 2026 22:54
@Byron
Copy link
Copy Markdown
Member

Sebastian Thiel (Byron) commented Apr 29, 2026

I have also updated 281, which now lists gix-traverse and highlights the lack of sha256 feature propagation. gix-object seems to be missing it, and maybe others as well.

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 64 out of 64 changed files in this pull request and generated 2 comments.

Comment thread gix-worktree-stream/Cargo.toml
Comment thread justfile
@Byron Sebastian Thiel (Byron) merged commit 23af41a into GitoxideLabs:main Apr 29, 2026
36 checks passed
@cruessler
Copy link
Copy Markdown
Contributor Author

While reviewing I noticed one thing that I think we should change from now on: unless the context really demands it, let's use object_hash as variable name for the hash kind. It's used in many other places already and it's feels more descriptive than hash_kind.

Perfect, I had started to notice a certain tension between hash_kind and object_hash, too, and I prefer object_hash as well.

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.

3 participants