3

Emacs has a beautiful feature: in the *vc-diff* buffer (generated by vc-diff either by C-x v = in a file buffer or by = in a *vc-dir* buffer), kill unwanted hunks with k (i.e., diff-hunk-kill) and then commit the remaining hunks with C-x v v (i.e., vc-next-action). If you don't know about it -- try it, it is incredibly useful!

Alas, it does not work for me on windows: after C-c C-c (i.e., log-edit-done) in *vc-log*, I get

vc-do-command: Failed (status 1): c:/Users/ssteingold/AppData/Local/Git/bin/git.exe --no-pager apply --cached c:/msys64/tmp/git-patchPbbWgJ

and *vc* buffer is

error: patch failed: fxpy/model.py:1071 error: fxpy/model.py: patch does not apply 

Additionally:

  1. Software:
  2. normal commits work just fine, using vc-next-action from either file buffer or *vc-dir*.
  3. All my files have unix line terminators (LF) as indicated in the mode line as (Unix)
  4. I set autocrlf to false globally
  5. I have (prefer-coding-system 'utf-8-unix) in .emacs
  6. vc-coding-system-inherit-eol is t, I did not touch it
  7. When I add "-v" to git apply invocation in vc-git-checkin (vc-git.el), *vc* buffer contains error: while searching for:..... and every line in ..... is terminated with ? - which seems to indicate line-ending problems... (!!!)

Q: how do I fix this? (This is a work box, I cannot send email from Emacs, so I cannot even file an Emacs bug report!)

5
  • Can't you send a bug report from some other computer? It's just an email - doesn't have to be composed in Emacs or sent from Emacs. Commented Jan 10, 2024 at 22:33
  • 1
    @Drew: okay, I did, and drew ire from Eli ;-( -- on the positive side, according to Dmitry, it has been fixed in the trunk. Commented Jan 11, 2024 at 14:15
  • It should be fixed for the upcoming 29.2 as well (the emacs-29 branch). Would be nice if you found the time to double-check, though. Commented Jan 11, 2024 at 20:04
  • @Dmitry: I will - as soon as there is a binary for me to download. Commented Jan 12, 2024 at 17:08
  • @sds I think it's now there. Commented Jan 26, 2024 at 1:17

2 Answers 2

0

To extract the answer from a comment: this should be fixed in the upcoming Emacs 29.2.

1
  • 1
    Confirmed - the bug has indeed been fixed. Commented Jan 30, 2024 at 18:27
1

work-around 1

Add

(setq coding-system-for-write 'utf-8-unix) 

inside (with-temp-file patch-file ...) in vc-git-checkin

work-around 2

Add

;; replace `undecided`: (setf (cadr (assoc "" file-coding-system-alist)) 'utf-8-unix) 

to .emacs

Emacs bug

vc-git-checkin should respect vc-coding-system-inherit-eol and set coding-system-for-write when writing the patch.

Also, it does not seem reasonable that prefer-coding-system does not affect file-coding-system-alist.

On the positive side, apparently this bug has already been fixed in the development tree.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.