emacs-devel
[Top][All Lists]
Advanced

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

Re: master 4803fba487 1/2: 'C-x v v' on a diff buffer commits it as a pa


From: Dmitry Gutov
Subject: Re: master 4803fba487 1/2: 'C-x v v' on a diff buffer commits it as a patch (bug#52349)
Date: Wed, 31 Aug 2022 14:11:57 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 31.08.2022 09:53, Juri Linkov wrote:
I can look into adapting this approach for other VCS if nobody beats
me to it. As long as we fundamentally agree on the behavior.
Thank you.
This seems to work.

Might use some extra polish, though, if people also encounter the one weird
error about "buffer already killed" that I saw a few times but then stopped
after a restart.
Thanks, looks universal enough to handle all backends.
I've tried it out, but it gets stuck asking the same question:

   Hunk has already been applied; undo it? (y or n)

because of the infinite loop in:

             (while (not (eobp))
               (diff-apply-hunk))

After removing the loop, everything works fine.

Do you perhaps have customized diff-advance-after-apply-hunk to nil? I guess a let-binding is in order.

But a loop is necessary because the diff can have more than one hunk, isn't it?

+(defun vc-default-checkin-patch (backend patch-string comment)
+  (with-current-buffer (get-buffer-create "*vc-checkin-patch*")
+    (erase-buffer)
+    (insert patch-string)
+    (diff-mode)
+    (pcase-let ((`(,backend ,files) (diff-vc-deduce-fileset))
+                (root (vc-call-backend backend 'root default-directory))
+                (tmpdir (make-temp-file "vc-checkin-patch" t)))
I'm worried that after a crash, reboot might wipe out the /tmp dir.

Creating the tmp directory inside root is also an option.



reply via email to

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