Skip to content

Switch to at_opts from at in gix-odb tests - #2901

Merged
Sebastian Thiel (Byron) merged 3 commits into
GitoxideLabs:mainfrom
cruessler:switch-to-gix-odb-at-opts
Aug 11, 2026
Merged

Switch to at_opts from at in gix-odb tests#2901
Sebastian Thiel (Byron) merged 3 commits into
GitoxideLabs:mainfrom
cruessler:switch-to-gix-odb-at-opts

Conversation

@cruessler

@cruessler Christoph Rüßler (cruessler) commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

gix_odb::at_opts() forces callers to select a hash while gix_odb::at() defaults to SHA-1 in SHA-1/SHA-256 builds, making most tests that use at fail under GIX_TEXT_FIXTURE_HASH=sha256. This has been a common theme in making tests SHA-256-ready: switching from at to at_opts, so that object_hash can be explicitly passed. If my LSP is correct, this PR switches the last remaining uses of at to at_opts.

gix_odb::at() implicitly selects SHA-1 as the default hash in SHA-1/SHA-256 builds which can be unexpected, cannot be overwritten and is a potential source of bugs. gix_odb::at_opts(), on the other hand, forces callers to explicitly provide Options which contain object_hash.

If I’m not missing anything, at does not have any callers anymore, now that the remaining ones are switched to at_opts. Which makes me wonder: can we remove at altogether? This PR is an attempt at answering that question.

Update after CI was green: it appears we could remove gix_odb::at if we wanted to. Other options include deprecating it or adding a warning to its docs that clearly state the potential for bugs in SHA-1/SHA-256 builds. Sebastian Thiel (@Byron) What do you think?

@cruessler
Christoph Rüßler (cruessler) marked this pull request as ready for review August 11, 2026 06:13

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

Copy link
Copy Markdown
Contributor

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: 5084f2e266

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

Comment thread gix-odb/src/lib.rs
`gix_odb::at()` implicitly selects SHA-1 as the default hash in
SHA-1/SHA-256 which can be unexpected, cannot be overwritten and is a
potential source of bugs. `gix_odb::at_opts()`, on the other hand,
forces callers to explicitly provide `Options` which contain
`object_hash`.
This way, a hash must be chosen, so that SHA-1 isn't hardcoded anymore.
@Byron
Sebastian Thiel (Byron) merged commit 2a4d996 into GitoxideLabs:main Aug 11, 2026
32 checks passed
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.

2 participants