GNU bug report logs - #60126
30.0.50; vc-git-checkin: Offer to unstage conflicting changes

Previous Next

Package: emacs;

Reported by: Sean Whitton <spwhitton <at> spwhitton.name>

Date: Fri, 16 Dec 2022 18:34:01 UTC

Severity: normal

Found in version 30.0.50

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 60126 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes
Date: Tue, 20 Dec 2022 17:13:10 +0200
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.

E.g. this way:

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index b5959d535c0..dee102d8586 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1052,7 +1052,7 @@ vc-git-checkin
                (lambda (value) (when (equal value "yes") (list 
argument)))))
       ;; When operating on the whole tree, better pass "-a" than ".", 
since "."
       ;; fails when we're committing a merge.
-      (apply #'vc-git-command nil 0 (if (and only (not 
vc-git-patch-string)) files)
+      (apply #'vc-git-command nil 0 (if only files)
              (nconc (if msg-file (list "commit" "-F"
                                        (file-local-name msg-file))
                       (list "commit" "-m"))

(I'm not sure if the list of files is passed to this function correctly 
when committing a patch; if not, fixing that would also be needed.)

> - offer to unstage any files with changes staged that*are*  modified by
>    the patch to be committed.

Or we could just abort, like we do now. Up to you (do you encounter this 
particular situation often?).

These could be two separate changes anyway.




This bug report was last modified 2 years and 150 days ago.

Previous Next


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