Add optional Git blame annotations for working-tree files - #3991
Open
Matei02355 wants to merge 2 commits into
Open
Add optional Git blame annotations for working-tree files#3991Matei02355 wants to merge 2 commits into
Matei02355 wants to merge 2 commits into
Conversation
Matei02355
marked this pull request as ready for review
September 7, 2026 17:27
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.
Show commit attribution before line numbers with --blame or the blame style component. Keep it opt-in, including when using the full style, and expose the same controls through PrettyPrinter.
Use gix's blame support to follow renames and merge history, then map HEAD attribution onto the current worktree with Git's clean-filter pipeline. Insertions, modifications and staged changes are marked uncommitted; unchanged lines retain their original commits. Handle linked worktrees, unborn repositories, untracked files and CRLF conversion. Preserve physical attribution when ranges, squeezing or nonblank numbering change the displayed line numbers.
Add --blame-format for commit hashes, author/committer names, emails, dates, Unix times and subjects. Sanitize metadata, truncate by Unicode grapheme boundaries to a bounded sidebar width, and leave wrapped continuation annotations empty. Ordinary UTF-8 files are supported; stdin, preprocessing, unbuffered input, binary files and files outside repositories omit attribution. History is computed before printing, so large histories can delay initial output.
This revisits the static blame feature proposed by @userwiths in #2851, which was welcomed after a rebase and later closed as stale. The implementation uses the repository's current gix dependency, enabling its blame feature and adding gix-blame 0.16.0.
Validation: all 487 all-feature tests passed (7 ignored), including 14 regressions comparing attribution against git blame across edits, renames, merges, worktrees and CRLF conversion. All 8 default-feature help tests passed. All-target/all-feature Clippy with warnings denied, formatting, whitespace checks, Bash/Zsh completion syntax, and a library build without Git or paging passed. README, manual, help snapshots and all four completions are updated. GitHub CI will validate other platforms.
Fixes #1536. Fixes #2810.