feat(blame, diff): add blame support, bump the git-internal version#70
Merged
genedna merged 2 commits intoweb3infra-foundation:mainfrom Nov 29, 2025
Merged
Conversation
additionally use the updated diff from git-internal crate, colorize the diff output, fix compatibility issues from version bump
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new libra blame command to show line-by-line commit attribution for files with support for line range filtering and Git-compatible formatted output. It also migrates diff functionality from a local diff_engine module to the git-internal crate (version 0.2.2) and refactors tests to use tempfile for better isolation.
Key changes:
- New blame command implementation with line-range support and timezone-aware timestamps
- Migration of diff operations from local implementation to git-internal crate v0.2.2
- Colorized diff output for terminal display
- Test refactoring to use tempfile instead of shared utilities
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/command/blame.rs | New blame command implementation with history walking and line attribution |
| src/command/diff.rs | Migrated to git-internal Diff API, added colorization, removed algorithm parameter |
| src/command/push.rs | Updated to use MetaAttached wrapper for Entry objects |
| src/command/index_pack.rs | Updated pack.decode() signature to accept MetaAttached entries |
| src/command/log.rs | Updated to use git-internal Diff API |
| src/command/mod.rs | Added blame module export |
| src/cli.rs | Added Blame command and routing |
| src/lib.rs | Removed diff_engine module |
| src/utils/lfs.rs | Refactored test to use tempfile for better isolation |
| src/internal/protocol/lfs_client.rs | Refactored test to use tempfile |
| tests/command/log_test.rs | Updated test expectations and migrated to git-internal Diff API |
| Cargo.toml | Bumped git-internal from 0.1.0 to 0.2.2 |
| Cargo.lock | Updated dependencies |
Contributor
Author
|
@genedna This Pull Request is ready for review/merge after applying all the suggested changes by copilot and fixing build errors. |
c5761b0 to
110e24f
Compare
genedna
approved these changes
Nov 29, 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.
This Pull Request implements the
libra blamecommand to show line-by-line commit attribution for files. The command walks backward through commit history using diff to track which commit last modified each line, with support for line range filtering (-L) and Git-compatible output formatting with timezone-aware timestamps piped through a pager. It bumps the git-internal dependency from version 0.1.0 to 0.2.2, which includes an updated diff implementation. The changes migrate diff operations from a local diff_engine module to the git-internal crate and add comprehensive blame support with line range selection.Key Changes
Notes:
In
tests/command/log_test.rsThe test values for insertions and deletions have changed from (4, 3) to (2, 1) because the previous version used a naive diff that marked ALL old lines as deleted and ALL new lines as inserted, and the tests were correct for previous version, so updated the tests.The current diff implementation doesn't support algorithm option, whilst the option can be provided, it serves no real purpose as of current implementation, if the the git-internal crate can be updated with algorithm support, the same can be added to libra.
[ This is a pre-task and part of r2cn and fixes #64 ]