Merged
Conversation
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
Signed-off-by: 你的名字 <你的邮箱@example.com>
Signed-off-by: 你的名字 <你的邮箱@example.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces initial SHA-256 support to the Libra Git engine core command layer, enabling the use of SHA-256 object IDs alongside the existing SHA-1 implementation. The changes are substantial and well-structured:
Purpose: Enable SHA-256 as an alternative hash algorithm for Git object IDs while maintaining backward compatibility with SHA-1 as the default.
Key Changes:
- Replaced the concrete
SHA1type with an abstractObjectHashtype throughout the codebase - Added hash algorithm selection during repository initialization (
--object-format sha1|sha256) - Introduced global hash kind management and initialization helpers
- Updated all commands, storage, and utility functions to work with the abstract hash type
- Added comprehensive test coverage for SHA-256 workflows
Reviewed changes
Copilot reviewed 144 out of 145 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| third-party/rust/crates/**/BUCK | Cleanup of unused third-party dependency definitions and feature flags |
| tests/command/*.rs | Added SHA-256 test cases for core workflows (commit, cherry-pick, checkout, blame, reset) |
| src/utils/*.rs | Updated utility functions to use ObjectHash abstraction |
| src/internal/*.rs | Updated internal types (Branch, Head, Tag, Reflog) to use ObjectHash |
| src/command/*.rs | All commands updated to support both hash algorithms with proper validation |
| src/command/init.rs | Enhanced to accept and validate --object-format parameter, initialize global hash kind |
| src/command/index_pack.rs | Added hash kind validation for pack index operations |
| src/command/commit.rs | Removed hard-coded empty tree hash, made it dynamic based on hash kind |
genedna
approved these changes
Dec 5, 2025
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.
Summary
#72
This PR introduces initial SHA-256 support for the core commands. The goal is to make it possible to run the existing command set with SHA-256 object IDs, while keeping the current SHA-1 behavior intact and configurable.
Changes
Behavior and Compatibility