GNU bug report logs - #64055
[WIP Patch] Enable editing commit messages - vc-git-modify-change-comment

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Morgan Smith <Morgan.J.Smith@HIDDEN>; Keywords: patch; dated Tue, 13 Jun 2023 23:05:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 64055 <at> debbugs.gnu.org:


Received: (at 64055) by debbugs.gnu.org; 14 Jun 2023 08:00:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 14 04:00:43 2023
Received: from localhost ([127.0.0.1]:43599 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q9LQo-00077r-PE
	for submit <at> debbugs.gnu.org; Wed, 14 Jun 2023 04:00:43 -0400
Received: from mail-wm1-f54.google.com ([209.85.128.54]:51482)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1q9LQm-00077c-6r
 for 64055 <at> debbugs.gnu.org; Wed, 14 Jun 2023 04:00:40 -0400
Received: by mail-wm1-f54.google.com with SMTP id
 5b1f17b1804b1-3f8d1eb535eso2467175e9.3
 for <64055 <at> debbugs.gnu.org>; Wed, 14 Jun 2023 01:00:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1686729634; x=1689321634;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=6K8VOU9VFFW0PNyNI4YbrznuGocuHYrHJasPlQYIIPg=;
 b=JOq9KOy9cD6vB+xXqq1gCFTxu7RgE9fGg0uVASOfizVNzAH8Qsd/doRYtBPkl+FaOZ
 8MwvYuEGIF5uh5YyZOpulgK++02FeCPi+qzWmwAZNM1E9zELqvau3WIYvflyHIl19yE1
 KTcSX1EwttR44HBnvI5BZx2l1HGtQ5ChUoAU5hwXZfz4Xu8xzy4AlK+iB8ufNZxh7Coi
 /5UH2L2N9zqwek990vJH7gr2UZGPPYRbL8oL3gCBOnjFWOLHNIqaxPoA601HUjfALtYB
 XKAC292A7eF6oEh2FCDmVw1jtHI9M3hvVD0HTxGMdv8vwSNZ0lGfz+3kdTKRs+NCkEK+
 5i4w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1686729634; x=1689321634;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=6K8VOU9VFFW0PNyNI4YbrznuGocuHYrHJasPlQYIIPg=;
 b=SqcgGrovAY38UF5bbEBgJ0uTmc8hDXnLs6YxbUCPYd3awHSThfhUvR7Tlk0/SpvDXF
 4+V+SNY2N5jdNPuLgD2XmbrEx4GRe8d/2vVhBDejX0VUqcYxvsEb8T+w91bZvWVMZqm3
 2Fpo3tg8CJICo1N1x7U1aqFYPvY1TOdcCvB5oGLX3Xz1B4wSEhlP9lI6Y/YqKXp4n4YQ
 PixJr/Jnk/n+I06PkALrMDp/B3U0omDtwQ4CDrmm0+hvVeLOB4KmLtk7QTNHVimmacfm
 2WmB2+P8gvIED7n/vc5+6WNmT/E5jir6+XcQPqZPy7PWc9tOt7iI9wTMEuJ3/yG9wbNg
 6BGQ==
X-Gm-Message-State: AC+VfDx2omSpZgxOX2TXTBZtZ4ACxi50Skfmg5txHbO4kYd2Mq6rU0El
 vlogdhPzLcBYl0LH6jKHWCuaHjNzg8Y=
X-Google-Smtp-Source: ACHHUZ7PutZccFNM5Yb/GSXjkCs9bb7koFZO+q6cd3G7KXuuIR8tsCGpQt/Brh/zmZo9xwr4+wiz5A==
X-Received: by 2002:a5d:61c4:0:b0:306:3b39:9a2a with SMTP id
 q4-20020a5d61c4000000b003063b399a2amr7341713wrv.42.1686729633474; 
 Wed, 14 Jun 2023 01:00:33 -0700 (PDT)
Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id
 e7-20020a056000120700b0030af8da022dsm17432359wrx.44.2023.06.14.01.00.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 14 Jun 2023 01:00:32 -0700 (PDT)
From: Robert Pluim <rpluim@HIDDEN>
To: Morgan Smith <Morgan.J.Smith@HIDDEN>
Subject: Re: bug#64055: [WIP Patch] Enable editing commit messages -
 vc-git-modify-change-comment
In-Reply-To: <DM5PR03MB3163ADD665E6B3B1D8704A2AC555A@HIDDEN>
 (Morgan Smith's message of "Tue, 13 Jun 2023 18:59:24 -0400")
References: <DM5PR03MB3163ADD665E6B3B1D8704A2AC555A@HIDDEN>
Date: Wed, 14 Jun 2023 10:00:32 +0200
Message-ID: <87pm5yo4m7.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 64055
Cc: 64055 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> On Tue, 13 Jun 2023 18:59:24 -0400, Morgan Smith <Morgan.J.Smith@outl=
ook.com> said:

    Morgan> Please look at this patch.  Ignore the bad commit message for n=
ow, I'm
    Morgan> trying to figure out how to edit that :P.

    Morgan> I've spent far too long looking at git documentation and source=
 code.  I
    Morgan> think this is the best way to enable this feature.  In fact I r=
eally
    Morgan> don't think there is another way to implement this feature that=
 doesn't
    Morgan> rely on the "autosquash" git feature.

Does 'git commit --amend -m' not work?

    Morgan> I found the hack located in vc-git-modify-change-comment' of se=
tting
    Morgan> "GIT_SEQUENCE_EDITOR=3D:" on the internet and I don't understan=
d how it
    Morgan> works.

    Morgan> Also I'm not really sure what the 'vc-dispatcher-browsing' func=
tion is
    Morgan> supposed to do but it's getting in my way.  Like are 'diff-mode=
' buffers
    Morgan> a "directory browser buffer"?  I don't understand the intent he=
re.

    Morgan> Also you'll noticed I deleted some comments in vc.el.  That's m=
ainly to
    Morgan> highlight them so we can talk about them now.  Is there a good =
way to
    Morgan> stop users from editing remote commits?

You can=CA=BCt stop anyone from doing anything on their local system, but I
guess you could check if 'git merge-base' is upstream.

    Morgan> I feel like I should probably just keep working on this and get=
 it more
    Morgan> polished and answer some of my own questions before posting her=
e but I'm
    Morgan> getting kind of frustrated with this.  I am many hours deep int=
o this
    Morgan> problem.

We can be your rubber duck :-)

Robert
--=20




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#64055; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 13 Jun 2023 23:04:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 13 19:04:44 2023
Received: from localhost ([127.0.0.1]:43237 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q9D47-0000cP-Ch
	for submit <at> debbugs.gnu.org; Tue, 13 Jun 2023 19:04:43 -0400
Received: from lists.gnu.org ([209.51.188.17]:57958)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <Morgan.J.Smith@HIDDEN>) id 1q9D46-0000cI-57
 for submit <at> debbugs.gnu.org; Tue, 13 Jun 2023 19:04:42 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Morgan.J.Smith@HIDDEN>)
 id 1q9D45-0007ty-Hp
 for bug-gnu-emacs@HIDDEN; Tue, 13 Jun 2023 19:04:41 -0400
Received: from mail-dm6nam11olkn20819.outbound.protection.outlook.com
 ([2a01:111:f400:7eaa::819]
 helo=NAM11-DM6-obe.outbound.protection.outlook.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Morgan.J.Smith@HIDDEN>)
 id 1q9D3z-0004Gb-QB
 for bug-gnu-emacs@HIDDEN; Tue, 13 Jun 2023 19:04:37 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=PkgZ38wZPX7QZsk0f+RFuHehj3qsZxUAKS+WUjNaUQ+LtIUoCb6aqIjn/4VOj7TqOT59tMT2Qv0TSESXTKhbNLelpr5t3nwIEfbX+ucf1C6eS3eETCCTxmdJ07trGcH3X4GVz8HkhUyRGkZeLA7vYHE2dTdoYrsdEaDdaeApNQp/x6lB/XMT8XZ4hmKqPWHXoZw3IXsyVN39foOs0OKvbCfWFxfOsaLNi+4PLyzZiNQI45SseAqoOcMQNlYP+gUAifMDIt9PAYrDXATvv4+Pk9tNGyZ5Bm6pkCP65Xt98Q/pnZ29hB9NHQy1t+LXVNPz2alZH+TU123S/9mhP5SwWQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=1IfYdW6aFM/vosqxthGQZFLinwSKv9RYvJQxObBKESw=;
 b=jA6bOGdXPfDEcVW1j8W+neYq+IXqWbyTDSSvZj/EbmsCxlOqeL2trD7Rf5Wy6w6QYrghnerjNv8MZMMduh/ex68WvcllFouo4DENBVlu6Vvue5/TrJSvSm/PxtvOJJ7TxEWTtwDedjQlwGv9Zy4iUdR9BKXaASxKQg50an5jcs6dWF9YoQ+DC0uZZ8fQaEp3goQKGsLdFzFzK+P3tggD217urQhiAr2b9BXPdugKG2jf+QT2uborleSOutep62Up30qBijVw5VMvET3gSaQlgf7YmnZU73ghVsOltVhSVAdiLgGe0Gp9+e83ldYemlOeUhncEgJxyIcidtMfOcZfeA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=1IfYdW6aFM/vosqxthGQZFLinwSKv9RYvJQxObBKESw=;
 b=X0LFlmeCT14R/pyOmTsbJqekj9cD6VudW+r3wAeBzj/8JpqhTLOf5gG1DKI4eiFgKZg6hFGY0TxRFoGDryuihoposrQ63Z6f3tSjq51cIhlub06P95AAtSRElsIl44h7gqTBQLjLQUH77sDRqnbyCCfNS0HgSL2LpelFsk37LlKgJZYxQzyywzZWdGj7ZDu5OTAcngk31bM4JGKh8g6KEKEcZGPDNBv+d0ip6QZd4FneIcaQQvqGQQbhv0lJAHhj3TWOcbKRKngqKFH2JPEhUjLmr6LzqxhMXHakLlbU1cavK6mCLdXBuQkQ9d1oXpGHbzi20bhXkvB0+Ci932Tbug==
Received: from DM5PR03MB3163.namprd03.prod.outlook.com (2603:10b6:4:40::24) by
 PH7PR03MB7338.namprd03.prod.outlook.com (2603:10b6:510:2f7::15) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Tue, 13 Jun
 2023 22:59:30 +0000
Received: from DM5PR03MB3163.namprd03.prod.outlook.com
 ([fe80::d561:bdf5:3af9:b03e]) by DM5PR03MB3163.namprd03.prod.outlook.com
 ([fe80::d561:bdf5:3af9:b03e%4]) with mapi id 15.20.6455.030; Tue, 13 Jun 2023
 22:59:29 +0000
From: Morgan Smith <Morgan.J.Smith@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [WIP Patch] Enable editing commit messages -
 vc-git-modify-change-comment
X-Hashcash: 1:20:230613:bug-gnu-emacs@HIDDEN::ixRCxR8V9DMz6U33:4PAC
Date: Tue, 13 Jun 2023 18:59:24 -0400
Message-ID: <DM5PR03MB3163ADD665E6B3B1D8704A2AC555A@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Content-Type: multipart/mixed; boundary="=-=-="
X-TMN: [wtsI2CI+uoRlrJ5F6g7U0Bz04vH+lmYE]
X-ClientProxiedBy: YQBP288CA0013.CANP288.PROD.OUTLOOK.COM
 (2603:10b6:c01:6a::9) To DM5PR03MB3163.namprd03.prod.outlook.com
 (2603:10b6:4:40::24)
X-Microsoft-Original-Message-ID: <877cs7ge9f.fsf@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM5PR03MB3163:EE_|PH7PR03MB7338:EE_
X-MS-Office365-Filtering-Correlation-Id: 9ac522d1-36ec-4750-427f-08db6c61d7ea
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: IIMBKzrS3TggR51pda9yMrucS6Lgjq+eTKgMnMYbBLZMhugw5vi+6BabSJSyzy+x9VjKNfFzlmkjWXMXIsVHwRipc8hVe0rpzP2tcfhP17NRdwBybG9wKNfSr1oqvuv8W4rWkhq7gaB4SfmrUsQy5j0J7u3LJC8lzGQER1uMEav7wgflEZbdkY1ukLGYYOvs8Tq/Q+xxNn+IAUAa0XZsYxO0fkqdT6pvlJXx2AJ22KszNg3UUnskG+izJDNbj2D0nTq/xGk4XsDa25Uog5krpMOGZYQH0xUmH0OBsEo5TzR31XVyfQRsgsuo5uAMbZCR
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?scnczk9JdRp2kAQyAQEFHeRem8GbLkyo2OkJwyTNpvmIwUPLnHnhhXgsdts3?=
 =?us-ascii?Q?/gVhiTmEQF/bJ05XZgmwkbfWf8x/NxUHz3FbrAzSjk8Q26H6JhAcZxDbErR/?=
 =?us-ascii?Q?qM5jJIKL13PhVYFuTZFNDAYpg0yPF451lkRr545EAWxhH0K2Bop7yfepLOCH?=
 =?us-ascii?Q?+CeqrRJ7/3aca6BCgEmrSH8uZQBJ0sMc4bc24FzF853lXQqBQ1Wrjjp3JA6q?=
 =?us-ascii?Q?3JA+wioyHSr4654Of5db7F9A0Q2Sa9urmTOCiUxYpplIpaDSDEzl/NxE0X8O?=
 =?us-ascii?Q?FdH1z5TLEYFC4fqlNpg6lUV4cCSmXRbxz9qQrjw3cLKjXa57FtVrxtw4ND0H?=
 =?us-ascii?Q?a04TQxiGHMOVQoYldLrVbkzAdUL+p9NniVAXE6ou+Bm3etwISRSQQl2REpvG?=
 =?us-ascii?Q?PV+y+frLOX/6Sg9JdFB4+YfXisvM+K+wWGIYOaiRGr/ePgnVN698UuhPkeWB?=
 =?us-ascii?Q?WjKHUWkU99SUvCRjTiRbjF8OjVml6w6yKVaAhtF6666LJ7SmGOcwAxjxRgaa?=
 =?us-ascii?Q?Tx8xf72BS47lfckO78DHlK11PCmiXVZcV7qfigaJtmha0if0fr/4NiKFS988?=
 =?us-ascii?Q?P3uaFJINLbQfknuMfhIitQ2xg8rpzrCikXL4tXzfN4t0rw59Y5k0wmQQkGa5?=
 =?us-ascii?Q?AwFjKeCARb2SzacKJv0gjwZmylVWT3j+ZNKcpoI6vop4Ap6XkDm211FnqD6j?=
 =?us-ascii?Q?bNj/6jQyWNdpY/bp3N/ZLgT+s18yJbGtxx+byxP8e3KLORxJAtTApT4TyfnJ?=
 =?us-ascii?Q?/o9tNuIiL/gg/m/l4udOXyUAgezGRxxCNsSlqcRJEIsj3vqZJcHpjrz7uQ/u?=
 =?us-ascii?Q?MtWH1SZmh8haX+Bj0u7J9OrxcxCg3dOJ6ODKbCxeZMBChDP4GKM30DYcBwFM?=
 =?us-ascii?Q?u3Y6X8kPRett+hnqop76B1eZbdnnWpf+yImn3EA50TEuupZFvAfA9lQTThG7?=
 =?us-ascii?Q?5QiHblr3OmgxlowYNNPhR60eWoDINwAoi+yzpkPHKSGOdZenDtTAMlcfCn3H?=
 =?us-ascii?Q?kb21YLKbDyt+jkAkiNpEbM0WeARtU7b8n3U6mnHkXO/KyXlzp2DFNNvtzYt8?=
 =?us-ascii?Q?G2ZUfmaryqdypBuaFZBDPINHKHT1GS8dWeV8Zl1Y0yx6HFVp43VskpPFEyjt?=
 =?us-ascii?Q?xOHJSwBnxp9+vzkouhOeZ1px1iaYDdJfa/zD8/JcZ371MCNNPeGgP2l2HE7q?=
 =?us-ascii?Q?1WYUXOn2NpwY1P7Bw5n9V7EXjPmYGmCHGyauFzneK67LFc99COs/4Cwq2ME?=
 =?us-ascii?Q?=3D?=
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 9ac522d1-36ec-4750-427f-08db6c61d7ea
X-MS-Exchange-CrossTenant-AuthSource: DM5PR03MB3163.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 22:59:29.8404 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR03MB7338
Received-SPF: pass client-ip=2a01:111:f400:7eaa::819;
 envelope-from=Morgan.J.Smith@HIDDEN;
 helo=NAM11-DM6-obe.outbound.protection.outlook.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Hello!


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-enable-editing-log-comments.patch

From dfff1a074dbcc244a1d6b40694b559c12c331a8f Mon Sep 17 00:00:00 2001
From: Morgan Smith <Morgan.J.Smith@HIDDEN>
Date: Tue, 13 Jun 2023 18:33:56 -0400
Subject: [PATCH] enable editing log comments

---
 lisp/vc/log-view.el      | 11 ++++++++---
 lisp/vc/vc-dispatcher.el |  4 +++-
 lisp/vc/vc-git.el        | 26 +++++++++++++++++++++++++-
 lisp/vc/vc.el            | 10 ----------
 4 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index e6eb6a5b973..86911eeb02c 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -522,9 +522,11 @@ log-view-find-revision
 (defun log-view-extract-comment ()
   "Parse comment from around the current point in the log."
   (save-excursion
-    (let (st en (backend (vc-backend (log-view-current-file))))
+    (let (st en (backend log-view-vc-backend))
+      (unless (get-text-property (car (log-view-current-entry)) 'log-view-entry-expanded)
+        (log-view-toggle-entry-display))
       (log-view-end-of-defun)
-      (cond ((eq backend 'SVN)
+      (cond ((memq backend '(SVN Git))
 	     (forward-line -1)))
       (setq en (point))
       (or (log-view-current-entry nil t)
@@ -533,7 +535,10 @@ log-view-extract-comment
 	     (forward-line 2))
 	    ((eq backend 'Hg)
 	     (forward-line 4)
-	     (re-search-forward "summary: *" nil t)))
+	     (re-search-forward "summary: *" nil t))
+            ((eq backend 'Git)
+             (re-search-forward "^$" nil t)
+             (forward-line 1)))
       (setq st (point))
       (buffer-substring st en))))
 
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index fd5f655a0f6..4351a71977e 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -827,7 +827,9 @@ vc-dispatcher-browsing
   "Are we in a directory browser buffer?"
   (or (derived-mode-p 'vc-dir-mode)
       (derived-mode-p 'dired-mode)
-      (derived-mode-p 'diff-mode)))
+      (derived-mode-p 'diff-mode)
+      (derived-mode-p 'log-view-mode)
+      ))
 
 ;; These are unused.
 ;; (defun vc-dispatcher-in-fileset-p (fileset)
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index a3469b71386..18d6f1f47dc 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1384,6 +1384,24 @@ vc-git-clone
     (vc-git--out-ok "clone" remote directory))
   directory)
 
+(defun vc-git-modify-change-comment (_files rev comment)
+  "Modify the change comments on REV to COMMENT."
+  ;; This is very similar to using to "git commit --fixup=amend"
+  ;; command but it is more precise as it does the rebase matching
+  ;; with the hash instead of the subject line.  Also we can't use
+  ;; --fixup non-interactively (it doesn't support -m or -F) so this
+  ;; is much easier.
+  (vc-git-command nil 0 nil "commit"
+                  "--allow-empty"
+                  "-m" (concat "amend! " rev "\n\n" comment))
+  ;; We should really be able to do this "non-interactively" but we
+  ;; can't so we set GIT_SEQUENCE_EDITOR
+  (let ((process-environment
+         (cons
+          "GIT_SEQUENCE_EDITOR=:"
+          process-environment)))
+    (vc-git-command nil 0 nil "rebase" "--autosquash" "-i" (concat rev "~1"))))
+
 ;;; HISTORY FUNCTIONS
 
 (autoload 'vc-setup-buffer "vc-dispatcher")
@@ -1576,7 +1594,13 @@ vc-git-expanded-log-entry
     (apply #'vc-git-command t nil nil
            `("log"
              ,revision
-             "-1"  "--no-color" ,@(ensure-list vc-git-log-switches)
+             "-1"  "--no-color"
+             ;; The same as the default "medium" format but it doesn't
+             ;; put spaces at the beginning of the body.  This is so
+             ;; we can grab this as the initial value when calling
+             ;; log-view-modify-change-comment
+             "--pretty=format:commit %H%nAuthor: %an %ae%nDate:   %ad%n%n%B"
+             ,@(ensure-list vc-git-log-switches)
              "--"))
     (goto-char (point-min))
     (unless (eobp)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index a93d85caedb..92a0ef74d56 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -699,16 +699,6 @@
 ;; - The git backend supports amending, but in a different
 ;;   way (press `C-c C-e' in log-edit buffer, when making a new commit).
 ;;
-;; - Second, `log-view-modify-change-comment' doesn't seem to support
-;;   modern backends at all because `log-view-extract-comment'
-;;   unconditionally calls `log-view-current-file'.  This should be easy to
-;;   fix.
-;;
-;; - Third, doing message editing in log-view might be a natural way to go
-;;   about it, but editing any but the last commit (and even it, if it's
-;;   been pushed) is a dangerous operation in Git, which we shouldn't make
-;;   too easy for users to perform.
-;;
 ;;   There should be a check that the given comment is not reachable
 ;;   from any of the "remote" refs?
 ;;
-- 
2.40.1


--=-=-=
Content-Type: text/plain


Please look at this patch.  Ignore the bad commit message for now, I'm
trying to figure out how to edit that :P.

I've spent far too long looking at git documentation and source code.  I
think this is the best way to enable this feature.  In fact I really
don't think there is another way to implement this feature that doesn't
rely on the "autosquash" git feature.

I found the hack located in vc-git-modify-change-comment' of setting
"GIT_SEQUENCE_EDITOR=:" on the internet and I don't understand how it
works.

Also I'm not really sure what the 'vc-dispatcher-browsing' function is
supposed to do but it's getting in my way.  Like are 'diff-mode' buffers
a "directory browser buffer"?  I don't understand the intent here.

Also you'll noticed I deleted some comments in vc.el.  That's mainly to
highlight them so we can talk about them now.  Is there a good way to
stop users from editing remote commits?


I feel like I should probably just keep working on this and get it more
polished and answer some of my own questions before posting here but I'm
getting kind of frustrated with this.  I am many hours deep into this
problem.

Thanks,

Morgan

--=-=-=--




Acknowledgement sent to Morgan Smith <Morgan.J.Smith@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#64055; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 14 Jun 2023 08:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.