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: Mon, 19 Dec 2022 23:43:44 -0700 Message-ID: <87zgbih8wv.fsf@melete.silentflame.com> References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1607"; 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 Tue Dec 20 07:44:30 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 1p7WMU-00005y-KB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Dec 2022 07:44:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7WM9-00057L-93; Tue, 20 Dec 2022 01:44:05 -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 1p7WM6-00056X-VH for bug-gnu-emacs@gnu.org; Tue, 20 Dec 2022 01:44: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 1p7WM6-0007RR-Jk for bug-gnu-emacs@gnu.org; Tue, 20 Dec 2022 01:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p7WM6-0007Mr-Fr for bug-gnu-emacs@gnu.org; Tue, 20 Dec 2022 01:44: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 06:44: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.167151863828306 (code B ref 60126); Tue, 20 Dec 2022 06:44:02 +0000 Original-Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 06:43:58 +0000 Original-Received: from localhost ([127.0.0.1]:42887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7WM1-0007MU-Sg for submit@debbugs.gnu.org; Tue, 20 Dec 2022 01:43:58 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:53181) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7WLx-0007MN-81 for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 01:43:56 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id AC0745C0106; Tue, 20 Dec 2022 01:43:45 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 20 Dec 2022 01:43:45 -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=1671518625; x=1671605025; bh=v3 b28gKpmRZABD39TYS9nDHxW+NJBHiMZWFaH0qDKGw=; b=l0sSXdp4IFYFlIxY9f Y4Ri2TqnNL2QHEh+f2fTXWVnRxQ7beHxsXDzugUbIEtYGTGSLH86TozS8pyMcx0U KtHxvsac9vm4rdvVRW3ZOqFtfudEY+IwJsfR8baZaqoEr71f5FTlX92+OKov4HeT XNfinsmQzHZF37WhIOsYrzM9pSFWdqt1XG2lb4HTlzQnWHHRcYeDmdRsH/UEByDC fC4KArUtjqF4S9kV7vXhIQvQ8CTbWrUZIC8uvInZ/Yd8FB1VfhKs1WRPqmWHpMS6 ckXEstnf867uncorlx6f3s43R/zD1PqgMj3U+7Wxlz1XE+Lqn6Y06fjaj51hFsL2 TSrw== 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=1671518625; x=1671605025; bh=v3b28gKpmRZABD39TYS9nDHxW+NJ BHiMZWFaH0qDKGw=; b=FYpHWrAt2j+Iv3YSMguom6QEQ4N3OVUjcq0UBDDsEJdP kg790HQZr83U0kYUJjX4M2gniyudd5j1aMM8gAAN8AiuM1UbrTR/Dvf5Ny8YRLxE 2ijZ77nR+DZerl23VKmdO3pX1MOuXT5vYvahw0zUXXxQEf2PumWsz355/TFkuftO S17vkAAUKyHZAoGkwTyYUviARRtEhzjFLaR819YkmwXm/RjZ4QIRR30Y9fW8hVyg BVQtDQusxkfNZ3saDPWTn5YHx9eXBW+CxBDt77FQYUNAR+V0J+CZAgc69nhXvdBk JyxYSLqjemE02HX6Tg1kbnpgrnN4bsYNgCpVWO2nHg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeeggdellecutefuodetggdotefrodftvf 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 01:43:45 -0500 (EST) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id 6BCF57EFE85; Mon, 19 Dec 2022 23:43:44 -0700 (MST) In-Reply-To: <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> (Dmitry Gutov's message of "Tue, 20 Dec 2022 02:53:28 +0200") 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:251496 Archived-At: Hello, On Tue 20 Dec 2022 at 02:53AM +02, Dmitry Gutov wrote: > On 20/12/2022 00:30, Sean Whitton wrote: >> This is a nice suggestion. A step further would be to unconditionally >> stash and unstash. Given how committing patches with C-x v v works, I >> don't believe it can ever be the case that the stash is not applicable >> afterwards? > > I'm not sure that's 100% true, given that we'll want to stage the contents of > the staging area (which are supposedly represented as diffs against the last > committed state), and our command, while keeping the contents of files on disk > intact, moves the last commit to a new state. Good point about the representation of the index. In addition, you can't stash just the content of the staging area, and not also the working tree, without hacks -- see `magit-stash-save' as called by `magit-stash-index'. I don't want to reproduce those hacks, so I was thinking we would be stashing both the worktree and the index for any and all files that have any changes staged. However ... >> If that's wrong, I'll implement what you suggest. > > ...but we might as well try and experiment. Worst case: the stash won't apply > cleanly and the user will have to do it by hand. That would mean no big loss > of information, at least. ... for files that are modified by the patch to be committed, it's very easy to generate situations where git can't or won't apply the stash. It's true that there isn't a loss of information, but it's a frustrating context switch for the user, who might not have even realised a stash would be created, and now has to untangle things. 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 - offer to unstage any files with changes staged that *are* modified by the patch to be committed. This way, we have to prompt the user only when files involved in the patch have staged changes, and we shouldn't ever force the user into dealing with a stash that won't apply. -- Sean Whitton