From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24380 invoked from network); 13 Feb 2022 15:29:34 -0000 Received: from lists.zx2c4.com (165.227.139.114) by inbox.vuxu.org with ESMTPUTF8; 13 Feb 2022 15:29:34 -0000 Received: by lists.zx2c4.com (OpenSMTPD) with ESMTP id 3301930c; Sun, 13 Feb 2022 15:29:17 +0000 (UTC) Return-Path: Received: from mta01.prd.rdg.aluminati.org (mta01.prd.rdg.aluminati.org [94.76.243.214]) by lists.zx2c4.com (OpenSMTPD) with ESMTPS id 713550ab (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Sun, 13 Feb 2022 15:29:16 +0000 (UTC) Received: from mta01.prd.rdg.aluminati.org (localhost [127.0.0.1]) by mta.aluminati.local (Postfix) with ESMTP id AEFA7C0297; Sun, 13 Feb 2022 15:29:16 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by mta01.prd.rdg.aluminati.org (Postfix) with ESMTP id A5BCA20206; Sun, 13 Feb 2022 15:29:16 +0000 (GMT) X-Quarantine-ID: <6VkshFrOBDUD> X-Virus-Scanned: Debian amavisd-new at mta01.prd.rdg.aluminati.org Received: from mta.aluminati.local ([127.0.0.1]) by localhost (mta01.prd.rdg.aluminati.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6VkshFrOBDUD; Sun, 13 Feb 2022 15:29:15 +0000 (GMT) Received: from river.lan (unknown [81.174.171.191]) by svc01-1.prd.rdg.aluminati.org (Postfix) with ESMTPSA id 4D9B71C0003; Sun, 13 Feb 2022 15:29:11 +0000 (GMT) From: John Keeping To: cgit@lists.zx2c4.com Cc: John Keeping , Alejandro Colomar Subject: [PATCH] blame: add a link to the parent commit Date: Sun, 13 Feb 2022 15:29:06 +0000 Message-Id: <5fe03939a1254f65961ea211ce5bd51bdc1e3895.1644766088.git.john@keeping.me.uk> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: cgit@lists.zx2c4.com X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: List for cgit developers and users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: cgit-bounces@lists.zx2c4.com Sender: "CGit" When walking through the history, it is useful to quickly see the same file at the previous revision, so add a link to do this. It would be nice to link to the correct line with an additional fragment, but this requires significantly more work so it can be done as an enhancement later. (ent->s_lno is mostly the right thing, but it is the line number in the post-image of the target commit whereas the link is to the parent of that commit, i.e. the pre-image of the target.) Suggested-by: Alejandro Colomar Signed-off-by: John Keeping --- ui-blame.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui-blame.c b/ui-blame.c index 03136f7..3b0bcad 100644 --- a/ui-blame.c +++ b/ui-blame.c @@ -54,6 +54,15 @@ static void emit_blame_entry_hash(struct blame_entry *= ent) html(""); free(detail); =20 + if (!parse_commit(suspect->commit) && suspect->commit->parents) { + struct commit *parent =3D 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"); } --=20 2.35.1