feat: support blame annotation for contents / worktree #2783
Sebastian Thiel (Byron)
started this conversation in
Feature Proposal
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary 💡
AI ANALYSIS OF MY ISSUE ( sorry I'm writing this in hurry )
Root cause (confirmed): This isn't a rendering glitch — the annotation panel is intentionally suppressed for working-tree diffs. In
crates/gitcomet-ui-gpui/src/view/panes/main/core_impl.rs:704, blame_path_rev_for_target() returns None for DiffTarget::WorkingTree, which makes
both annotation_active() (panel visibility, line 2853) and request_blame_for_current_target() (data load, line 2899) short-circuit. A documented
comment explains why: the annotation column maps blame lines onto new-side line numbers 1:1 (blame_for_new_line, blame.rs:30), but for
working-tree diffs the new side is uncommitted content, so indexing committed (HEAD) blame by those line numbers misattributes every line below
an uncommitted edit.
The real constraint: gix 0.84's blame_file can only blame committed content (suspect:) — there's no --contents/worktree-blame support. I
confirmed the diff bases too: unstaged = index → worktree, staged = HEAD → index. So in both cases the new side is uncommitted, which is the
crux.
This means simply deleting the guard would produce visibly wrong attributions. There are a few genuinely different ways to do this correctly,
with real tradeoffs — so I need your input before writing the plan.
Motivation 🔦
We are building GitComet and would like to show annotation / blame data when users are viewing unstaged / untracked / staged files.
Originally proposed by Sampo Kivistö (@Havunen) in issue #2666.
All reactions