]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-blame.c
ui-blame: add a link to the parent commit in blame
[ps-cgit] / ui-blame.c
index 4adec2b99e5f19af19109f92677def0e635e5e9a..aedce8dfd24aa0b4db686360120bdd04b0a0cd5f 100644 (file)
@@ -54,6 +54,15 @@ static void emit_blame_entry_hash(struct blame_entry *ent)
        html("</span>");
        free(detail);
 
+       if (!parse_commit(suspect->commit) && suspect->commit->parents) {
+               struct commit *parent = suspect->commit->parents->item;
+
+               html(" ");
+               cgit_blame_link("^", "Blame the previous revision", NULL,
+                               ctx.qry.head, oid_to_hex(&parent->object.oid),
+                               suspect->path);
+       }
+
        while (line++ < ent->num_lines)
                html("\n");
 }