Skip to content

feat: support blame annotation for contents / worktree #2666

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions