bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Dmitry Gutov
Subject: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes
Date: Tue, 20 Dec 2022 17:13:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]