Commit Diff


commit - 060188130c8b49319ecc9068d38e1be6a2f70f8e
commit + ac4dc26386a91b9c488d78fd7065780e1eaf33d7
blob - 88e42baaf5d6e7a213d94fdf05adf31d18c574f0
blob + dc7046265930c91fe7370ec5e4560cc5e11e663a
--- tog/tog.c
+++ tog/tog.c
@@ -3234,6 +3234,29 @@ write_commit_info(off_t **line_offsets, size_t *nlines
 		if (err)
 			goto done;
 	}
+	if (got_object_commit_get_nparents(commit) > 1) {
+		const struct got_object_id_queue *parent_ids;
+		struct got_object_qid *qid;
+		int pn = 1;
+		parent_ids = got_object_commit_get_parent_ids(commit);
+		STAILQ_FOREACH(qid, parent_ids, entry) {
+			err = got_object_id_str(&id_str, qid->id);
+			if (err)
+				goto done;
+			n = fprintf(outfile, "parent %d: %s\n", pn++, id_str);
+			if (n < 0) {
+				err = got_error_from_errno("fprintf");
+				goto done;
+			}
+			outoff += n;
+			err = add_line_offset(line_offsets, nlines, outoff);
+			if (err)
+				goto done;
+			free(id_str);
+			id_str = NULL;
+		}
+	}
+
 	err = got_object_commit_get_logmsg(&logmsg, commit);
 	if (err)
 		goto done;
@@ -3535,8 +3558,8 @@ open_diff_view(struct tog_view *view, struct got_objec
 		}
 
 		err = add_color(&s->colors,
-		    "^(commit [0-9a-f]|(blob|file) [-+] |[MDmA]  [^ ])",
-		    TOG_COLOR_DIFF_META,
+		    "^(commit [0-9a-f]|parent [0-9]|(blob|file) [-+] |"
+		    "[MDmA]  [^ ])", TOG_COLOR_DIFF_META,
 		    get_color_value("TOG_COLOR_DIFF_META"));
 		if (err) {
 			free_colors(&s->colors);