Repository navigation
fix: support SHA-256 git repositories in --diff - #4143
Merged
Merged
Conversation
gix was built without its `sha256` feature, so repositories created with `git init --object-format=sha256` could not be opened and `get_git_diff` returned None. `--diff` then printed no content and `--style=changes` showed no change markers, both with exit code 0. Enable the gix `sha256` feature and add a regression test.
keith-hall
approved these changes
Nov 21, 2026
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.
In a repository created with
git init --object-format=sha256,bat --diffprinted no line content and--style=changesshowed no change-marker column, both with exit code 0 — indistinguishable from "no changes".batbuildsgixwithdefault-features = falseand onlysha1+blob-diff; gix gates SHA-256 repository support behind itssha256feature, so gix cannot open the repository andget_git_diff()returnsNone.Enabling the
sha256feature restores diff mode and the change-marker column in SHA-256 repositories; SHA-1 repositories are unchanged. The lockfile change is limited to the seven RustCrypto crates pulled in by that feature.Tests:
diff_is_calculated_in_sha256_repositorycreates agit init --object-format=sha256repository, commits, modifies a tracked file, and assertsget_git_diffreturns the added line. It fails onmasterand passes here.cargo test --locked --lib— 155 passed;cargo test --locked --test integration_tests diff— 5 passed.cargo fmt --check;cargo clippy --locked --all-targets --all-features -- -D warnings.bat --diffand--style=changesshow the changed line in a SHA-256 repository; a SHA-1 repository behaves as before.CHANGELOG.mdBugfixes entry added per the repository's changelog workflow.