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: Sat, 24 Dec 2022 11:22:45 -0700 Message-ID: <87fsd47jbe.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> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> <878riybwhy.fsf@melete.silentflame.com> <8735958spl.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="25190"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 60126-done@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 Sat Dec 24 19:23:23 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 1p99B3-0006H7-QE for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Dec 2022 19:23:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p99An-0003PW-G5; Sat, 24 Dec 2022 13:23: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 1p99Al-0003Oy-8D for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 13:23: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 1p99Ak-0004eZ-Qf for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 13:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p99Ak-0006NZ-ME for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 13:23: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: Sat, 24 Dec 2022 18:23: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-done@debbugs.gnu.org id=D60126.167190617524470 (code D ref 60126); Sat, 24 Dec 2022 18:23:02 +0000 Original-Received: (at 60126-done) by debbugs.gnu.org; 24 Dec 2022 18:22:55 +0000 Original-Received: from localhost ([127.0.0.1]:47130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p99Ac-0006Mb-Vw for submit@debbugs.gnu.org; Sat, 24 Dec 2022 13:22:55 -0500 Original-Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:58931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p99Aa-0006MP-Tw for 60126-done@debbugs.gnu.org; Sat, 24 Dec 2022 13:22:54 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 111DA32004E7; Sat, 24 Dec 2022 13:22:46 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 24 Dec 2022 13:22:47 -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=1671906166; x=1671992566; bh=55 w/CWlg3DlZd0NLPqqUtPr16dDOGUMkM1NqHreIU8I=; b=OfVUuxzMKxBkbYcZ5O dCJXrjSc8y7JWAGXWJfn3M8Hfuz9tWluzAS+XVuO1tSNK5xJPseMzPrmVuiaD9LJ WgAlPTIlEAy5cZtBk61jGE+hb9kBcNgymOx5O3kwPiVIrvrm1P3pwUXf9OI2jmfw OOATyC6tSVXnvc0K9IeKF0jHj7/rqKMR6mwADpWM3A4jbk8nEIKhMcDEYVke7vkt zk8PBJIGv0jC4edYtJZZ90wxg1DYFUKp8y18Ijrj8AeUfaRy73GRN66nr81rOqc4 EJ2ksCKJ+o9Jf1LASOT8E1FnpssjhMGVjOPMAdFgmkyDuHxOwdtYtH6BPLIIcYAw sUDw== 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=1671906166; x=1671992566; bh=55w/CWlg3DlZd0NLPqqUtPr16dDO GUMkM1NqHreIU8I=; b=XW3XueeZslEeT1fR5rruC4kk880bEQ/QdSdNEvBj/w/e UJil8mTET/PlhRYatfNpAeQXWeAwJ0tbRniwDStGgVKPm6k4LtWZwkBl9ZLVj342 ax/nxeeGlYQrrc7YZzvXES4BhcP8q4t9SJAnJcX+CsI3VuKRunRHLIDZnEnLcR70 EmojJIPQ7WD1usNC9l/9zaPIrBCHW2XdXIlJglKlD2TT0egAdNgmAmBvO6dALvTJ F8meNcLrddUw695Ym3Zng46FxtVBGM5arwtXng9uuGILriUiKsYSPaub/p4hiWQI YMBAwUqSyX9jag+jnldECRdFWCLn6YaDpsp+HuPcbQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrheeggdduudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkfgggtgesthdttddttdertdenucfhrhhomhepufgvrghn ucghhhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpeejtdejgfehleeghfevffefhfejffeuteegfefhiedtgeej ffefkeevlefhgfefieenucffohhmrghinhepvghlrdhonhgvpdgvlhdrnhhofienucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsphifhhhithht ohhnsehsphifhhhithhtohhnrdhnrghmvg X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 24 Dec 2022 13:22:46 -0500 (EST) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id 7B0D87F04CD; Sat, 24 Dec 2022 11:22:45 -0700 (MST) In-Reply-To: (Dmitry Gutov's message of "Sat, 24 Dec 2022 16:50:55 +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:251812 Archived-At: Hello, On Sat 24 Dec 2022 at 04:50PM +02, Dmitry Gutov wrote: > It does indeed feel like we ended up in a good place. The code was pretty > complex, though, and got more so. > > We don't have tests covering vc-git-checkin-patch at all. Any chance you'll > fancy working on adding those? Even if you only cover the scenarios where the > user doesn't get prompted at all (either there's nothing staged, or the staged > contents match the committed patch). > > Writing (and debugging) a test could also help sort out fiddly behaviors, like > the one you may have seen yesterday. > > We have a default implementation for checkin-patch, so adding generic test for > all major backends could work (in vc-tests.el). One or two extra tests could > be also predicated on (eq backend 'Git), so that we don't yet need to copy the > repository setup/teardown code to vc-git.el. Now that we understand clearly what we want it to do, I bet the code in vc-checkin-git could be simplified (vc-git--stash-staged-changes is fine). So I'll see about doing that, with some tests, as you suggest. Let me ask you about the parsing of the 'diff --git' lines. I wasn't happy with my regexp approach to extracting the filename. I'm not sure it can actually fail, but the current codes assumes it can, and that adds complexity. The --src-prefix, --dst-prefix and --no-prefix options to git-diff(1) might be relevant, but then we couldn't use a simple string-match to find hunks in vc-git-patch-string. Do you have any better ideas of how to extract the filename from the git --diff line, or perhaps a proof that my approach can't fail? :) -- Sean Whitton