GNU bug report logs - #52349
29.0.50; vc-git and diff-mode: stage hunks

Previous Next

Package: emacs;

Reported by: Manuel Uberti <manuel.uberti <at> inventati.org>

Date: Tue, 7 Dec 2021 09:00:02 UTC

Severity: normal

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

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: Juri Linkov <juri <at> linkov.net>
Cc: 52349 <at> debbugs.gnu.org
Subject: bug#52349: 29.0.50; vc-git and diff-mode: stage hunks
Date: Mon, 14 Feb 2022 00:51:54 +0200
On 13.02.2022 21:48, Juri Linkov wrote:
> This is fine, so this patch does this:
> 
>           (if patch-string
>               (vc-call-backend backend 'checkin files comment rev patch-string)
>             (vc-call-backend backend 'checkin files comment rev))

Looks good, thanks!

Sorry, I haven't noticed your emails today before I wrote my own. See if 
you like the suggestion in there, but this patch is also fine with me. 
Though we might try catching the wrong-number-of-arguments error to 
report a friendlier explanation to the user.

> Also I added the new arg ‘patch-string’ to vc-checkin and vc-start-logentry.
> These are not API calls, so they could use a buffer-local variables instead
> of args, but I'm not sure about this less important technical detail.

Since the new args are optional, should be fine.

> +    (when patch-string
> +      (let ((patch-file (make-temp-file "git-patch")))
> +        (with-temp-file patch-file
> +          (insert patch-string))
> +        (unwind-protect
> +            (apply #'vc-git-command nil 0 patch-file
> +                   (list "apply" "--cached"))
> +          (delete-file patch-file))))

Perhaps we should also check that there are no existing staged changes 
for those files, and if so, abort? This way we won't commit anything 
else by accident.




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

Previous Next


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