From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Date: Sat, 24 Dec 2022 16:50:55 +0200 Message-ID: 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; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17622"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: 60126-done@debbugs.gnu.org, juri@linkov.net To: Sean Whitton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 24 15:52:12 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 1p95sh-0004Mo-RA for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Dec 2022 15:52:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p95sa-0007OX-Jj; Sat, 24 Dec 2022 09:52:04 -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 1p95sY-0007ON-U4 for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 09:52:02 -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 1p95sY-0007hQ-Lz for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 09:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p95sY-0004v0-5s for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 09:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Dec 2022 14:52: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.167189347018869 (code D ref 60126); Sat, 24 Dec 2022 14:52:02 +0000 Original-Received: (at 60126-done) by debbugs.gnu.org; 24 Dec 2022 14:51:10 +0000 Original-Received: from localhost ([127.0.0.1]:43334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p95ri-0004uH-C8 for submit@debbugs.gnu.org; Sat, 24 Dec 2022 09:51:10 -0500 Original-Received: from mail-wm1-f45.google.com ([209.85.128.45]:33611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p95rb-0004tp-Sd for 60126-done@debbugs.gnu.org; Sat, 24 Dec 2022 09:51:08 -0500 Original-Received: by mail-wm1-f45.google.com with SMTP id z8-20020a05600c220800b003d33b0bda11so6475498wml.0 for <60126-done@debbugs.gnu.org>; Sat, 24 Dec 2022 06:51:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=Hh+JMfAx0dhfBVIeIQ8u1fucbAz/sLGH+dki2oaHxj4=; b=BStD2hxnBv99QmeFGn9brg98ThRf+rIZRRDvT6vWECccXioTfJtbsJ2K87iCYUA9xD iN8wXCRNQz3AZl9vwwlq8hvJleQkkFF2Vcz7lXQmkzqktVxQdTp9okz9WU6f1G4lTh4B ayTCHr0fdA085vpZJEnyGZm8VZwWAwSu2Ji+q+z5HRrnNyTxJyasvh6oVqYG1rNCGH1h cuSdO/ezVU2I4TFB5AW2BjSCf4H3v4fsrWd92Cent3DQzfFFGiqbJ92/h4W55nmkDIUw EV7+DOBDKzZC/To8eylry9wX9VQyo9UOAHzlkwMsTbv5hrfqZ7SlGyhCeGdsei/GDj3v Jb5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Hh+JMfAx0dhfBVIeIQ8u1fucbAz/sLGH+dki2oaHxj4=; b=vJoiqBbWV7fSi1hCJuDqjRKc6bP2X8E4pLZum5D/ufxasiHgKnuEx2Y34cQ6pCWEAA nuF/bTh/8VK9VMZukqhuBBzuadF3uLcUrs5XxbQem9QmAYgHmpMEoqxY76QGSkdyBudI oqvZQz4m2BqWIKzsYIRCXMcHXrbjZydR+H3xQfyh+MkaQCsR0HLCwbw6XWheZZel91zh kimdcwyxMKIakDdRri3QObJ8I1OhLNWgN97CMQ9YG3TQN6bdLpr8h2mMUz8b3Wjva2BB 04ts+VPkgf0gxxs2IecfiF2stYQHVGlcI9q9F/2fI6UT2T4ZCXEQVQt0PD7QrbiK0ytB /w/g== X-Gm-Message-State: AFqh2krfMICBXkCUEykQTaM9dMvM3nTZ2QFinKWOuJDZrzin5RgjqWOZ mO9pmfNdmZ+60X6wtYChixc= X-Google-Smtp-Source: AMrXdXuS1dr37PY/4NTLCO37dWUAO/rYQJYhshgjEcGpeEAK7LtPhF2WB+QkGK1NpjzHXIUrW7PeHA== X-Received: by 2002:a05:600c:22d4:b0:3cf:82b9:2fe6 with SMTP id 20-20020a05600c22d400b003cf82b92fe6mr11163204wmg.8.1671893457756; Sat, 24 Dec 2022 06:50:57 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id bd25-20020a05600c1f1900b003cfd4cf0761sm12839538wmb.1.2022.12.24.06.50.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 24 Dec 2022 06:50:57 -0800 (PST) Content-Language: en-US In-Reply-To: <8735958spl.fsf@melete.silentflame.com> 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:251803 Archived-At: On 24/12/2022 04:02, Sean Whitton wrote: > Hello, > > On Sat 24 Dec 2022 at 01:18AM +02, Dmitry Gutov wrote: > >> On 23/12/2022 05:59, Sean Whitton wrote: >>> It works, except that sometimes the let-binding of process-environment >>> fails, such that the commands affect the normal index rather than the >>> temporary index. Can you see what I'm doing wrong there? >> Could you describe be "sometimes" occurrences? Does that happen through >> repeating a similar action several times? Or slightly different actions? >> >> The process-environment setup seems fine. We did corrupt it in 1-2 places in >> the past using 'setenv', but I don't see anything like that in the current >> codebase. And the effect would probably be different anyway. > Thank you for looking. Slightly embarassingly, I can't reproduce the > problem today. So I've gone ahead and pushed. Thanks! > I am pretty happy with this approach, in the end. Compared with other > possible uses of 'git stash', it's quite clean: > > - it doesn't touch the worktree copies of the files not involved in the > commit > > - it stashes a single diff, rather than two diffs (one for the worktree > and one for the index), which is less for the user to deal with if > manual recovery becomes required. 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.