From da4ece9db2984d99b33d15e15cd87cb009246ac2 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 1 Nov 2026 11:01:53 -1000 Subject: Blame the previous revision under its own name --- source/ui-blame.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/ui-blame.c b/source/ui-blame.c index eef8602..46d1654 100644 --- a/source/ui-blame.c +++ b/source/ui-blame.c @@ -127,6 +127,7 @@ static char *suspect_detail(struct blame_origin *suspect) static void emit_entry_hash(struct blame_entry *ent) { struct blame_origin *suspect = ent->suspect; + struct blame_origin *previous = suspect->previous; struct object_id *oid = &suspect->commit->object.oid; const char *detail = suspect_detail(suspect); @@ -137,13 +138,14 @@ static void emit_entry_hash(struct blame_entry *ent) ); html(""); - if (!repo_parse_commit(the_repository, suspect->commit) && suspect->commit->parents) { - struct commit *parent = suspect->commit->parents->item; - + // git records the parent along with the path the file had there, + // which a rename changes, and records none for the commit that + // created the file. + if (previous) { html(" "); cgit_blame_link( "^", "Blame the previous revision", NULL, ctx.qry.head, - oid_to_hex(&parent->object.oid), suspect->path + oid_to_hex(&previous->commit->object.oid), previous->path ); } -- cgit 2.12.1