|
From: | Dmitry Gutov |
Subject: | bug#68377: Cannot commit parts of *vc-diff* on Microsoft Windows |
Date: | Thu, 11 Jan 2024 15:19:26 +0200 |
User-agent: | Mozilla Thunderbird |
On 11/01/2024 14:28, Eli Zaretskii wrote:
From: Sam Steingold <sds@gnu.org> Date: Wed, 10 Jan 2024 21:07:14 -0500 https://emacs.stackexchange.com/q/80039/795 Emacs has a beautiful feature: in the `*vc-diff*` buffer (generated by [`vc-diff`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Old-Revisions.html) either by <kbd>C-x v =</kbd> in a file buffer or by <kbd>=</kbd> in a `*vc-dir*` buffer), kill unwanted hunks with <kbd>k</kbd> (i.e., [`diff-hunk-kill`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Diff-Mode.html)) and then commit the remaining hunks with <kbd>C-x v v</kbd> (i.e., [`vc-next-action`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Basic-VC-Editing.html)). If you don't know about it -- try it, it is incredibly useful!(I must say that formatting of this report is AWFUL! How can a human being be expected to read and understand it it?? PLEASE try to make bug reports more readable in the future.)
Looked fine to me. I think the Markdown format is very readable.
Alas, it does _not_ work for me on windows: after <kbd>C-c C-c</kbd> (i.e., [`log-edit-done`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Log-Buffer.html)) in `*vc-log*`, I getvc-do-command: Failed (status 1): c:/Users/ssteingold/AppData/Local/Git/bin/git.exe --no-pager apply --cached c:/msys64/tmp/git-patchPbbWgJand `*vc*` buffer is ``` error: patch failed: fxpy/model.py:1071 error: fxpy/model.py: patch does not apply ``` ***Additionally***: 1. Software: * [`GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-08-02`](https://ftp.gnu.org/gnu/emacs/windows/emacs-29/) * [`git version 2.42.0.windows.2`](https://gitforwindows.org/) 1. *normal* commits work just **fine**, using `vc-next-action` from either file buffer or `*vc-dir*`. 1. All my files have unix line terminators (`LF`) as indicated in the mode line as `(Unix)` 1. I set `autocrlf` to `false` globally 1. I have `(prefer-coding-system 'utf-8-unix)` in `.emacs` 1. `vc-coding-system-inherit-eol` is `t`, I did not touch it 1. 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!) # work-around 1 Add ``` (setq coding-system-for-write 'utf-8-unix) ``` inside `(with-temp-file patch-file ...)` in `vc-git-checkin`The code in question already does: (let ((patch-file (make-nearby-temp-file "git-patch")) ;; Temporarily countermand the let-binding at the ;; beginning of this function. (coding-system-for-write (coding-system-change-eol-conversion ;; On DOS/Windows, it is important for the patch file ;; to have the Unix EOL format, because Git expects ;; that, even on Windows. (or pcsw vc-git-commits-coding-system) 'unix))) (with-temp-file patch-file (insert vc-git-patch-string)) So coding-system-for-write should already be -unix when with-temp-file runs. I guess there's more here than meets the eye, or maybe I'm missing something.
I think this is the same as bug#65049, meaning that it's fixed on master, but not in Emacs 29.1 (which was the version specified in the report).
[Prev in Thread] | Current Thread | [Next in Thread] |