From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.bugs Subject: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Date: Tue, 20 Dec 2022 16:10:00 -0700 Message-ID: <87zgbh1xkn.fsf@melete.silentflame.com> References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38884"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 60126@debbugs.gnu.org, juri@linkov.net To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 21 00:16:09 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7lqB-0009t8-KS for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Dec 2022 00:16:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7llN-0002gr-31; Tue, 20 Dec 2022 18:11:09 -0500 Original-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 ) id 1p7llH-0002e9-1F for bug-gnu-emacs@gnu.org; Tue, 20 Dec 2022 18:11:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7llG-0000Tx-P6 for bug-gnu-emacs@gnu.org; Tue, 20 Dec 2022 18:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p7llG-0005bK-9Z for bug-gnu-emacs@gnu.org; Tue, 20 Dec 2022 18:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Dec 2022 23:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60126 X-GNU-PR-Package: emacs Original-Received: via spool by 60126-submit@debbugs.gnu.org id=B60126.167157781021517 (code B ref 60126); Tue, 20 Dec 2022 23:11:02 +0000 Original-Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 23:10:10 +0000 Original-Received: from localhost ([127.0.0.1]:47672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7lkQ-0005az-3i for submit@debbugs.gnu.org; Tue, 20 Dec 2022 18:10:10 -0500 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:41745) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7lkO-0005ar-Hv for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 18:10:09 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 84E9B3200981; Tue, 20 Dec 2022 18:10:02 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 20 Dec 2022 18:10:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1671577802; x=1671664202; bh=6s 968GB7lSxxYrSEEdZj+6GBK9zJVN8joONme0MhH20=; b=osG5pOTKZkhPgR599R 2M2baC5I7CMYwgkq5/QM8G/3u/sElGz4d/rofIMNBa1RaSMU5GN+QcPxLqdDDMWf oqnEmwmydk/aVFIowKUU7IS+KciUmxZUNheEivnWw94XXwzP1EFRw3PeaM7MTjd/ xf1fQkm6iv/+TRz6X0d4UjsgXZA3fYtZoNegePW0YqMD6XjN6kBwOejZBIal+3K8 DGY/JUIqsDVWu+f6oWaCkjuOxeOgiRlaYwqdrTQVNKMhRhTB30sPMsQPgYu/Vcvp 72swhM458wDaCbllnSdNjEfWYTi0PXtjkZPBWYwJp0kbOxEcnJXpsLr30ZplA39S +syQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1671577802; x=1671664202; bh=6s968GB7lSxxYrSEEdZj+6GBK9zJ VN8joONme0MhH20=; b=Ea3XpZm6pRJfv+39Dvue4Mf9FxeheQIrvpmC/3i5EUeN PVmkRjdp2yW8B9QVx9HPunxXL5aM0E3Eihn15+UZe9lvSONreygmx2rpFcDkBKnc UfqOPOq285G/bzb/paCaN/TggGde70H2RIUdFuavskDpYQpC6sxTQgctxCbsWKu7 GXHuuim+BJzq9H3yZSI8kjSScQlA7JN8SAHWbeETiBexPAA0+s5EOkD8PkGh5+Js Cb04b+czsmlMWuexuVUgdNnDV4KLZ1COtKH7ThRvaiL+34iK1JYeUX+Lyyj9h/21 ctHRiq4zwuFU5bh0W6e4nd4ObBW/NmZhAzLEO6u/FA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeejgddtiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Dec 2022 18:10:01 -0500 (EST) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id 145087EEB39; Tue, 20 Dec 2022 16:10:00 -0700 (MST) In-Reply-To: <87h6xqgg65.fsf@melete.silentflame.com> (Sean Whitton's message of "Tue, 20 Dec 2022 10:04:34 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251543 Archived-At: Hello, On Tue 20 Dec 2022 at 10:04AM -07, Sean Whitton wrote: > On Tue 20 Dec 2022 at 05:13PM +02, Dmitry Gutov wrote: > >> On 20/12/2022 08:43, Sean Whitton wrote: >>> So, I'm now thinking: >>> - automatically stash index+worktree for any files with changes staged >>> that are*not* modified by the patch to be committed >> >> I think it's possible to just skip those when checking the index area. And >> then, when committing, specify individual files to commit from the index. > > Ah, so it is! It turns out this doesn't work: if you specify individual files to commit from the index, then git also includes any changes to those files in the worktree too, and you can't ask it not to, because --only is implied whenever files are supplied on the command line. In other words, when vc-git-patch-string is non-nil, we mustn't pass a list of files to git. So if there are files not involved in the commit with staged changes, we need to stash those. I tried implementing that, which is not hard, but then we pop that stash, the staged changes aren't restored to the index. The result is that if the user has a mixture of staged and unstaged changes to a file which is not part of the commit, then afterwards the unstaged changes will have been unstaged, mixed in with the staged changes again. In some circumstances this could constitute a loss of work. There are a few ways to overcome this. We can use the --staged option, but that's only available in very recent versions of git. We could perform a complex double-stash: - git stash push -k -- foo - git reset -- foo - git stash push -k -- foo - [commit] - git stash pop - git add -- foo - git stash pop Or we could do something like what Magit does to stash only the index. Any thoughts on what would be best? In the meantime, I've pushed a version of my previous patch, as I think it makes sense to implement the stashing, if we do, as a second change. -- Sean Whitton