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.
+(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.