GNU bug report logs - #68377
Cannot commit parts of *vc-diff* on Microsoft Windows

Previous Next

Package: emacs;

Reported by: sds <at> gnu.org

Date: Thu, 11 Jan 2024 02:08:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#68377: closed (Cannot commit parts of *vc-diff* on Microsoft
 Windows)
Date: Sat, 10 Feb 2024 08:08:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 10 Feb 2024 10:06:45 +0200
with message-id <86il2wvj3e.fsf <at> gnu.org>
and subject line Re: bug#68377: Cannot commit parts of *vc-diff* on Microsoft Windows
has caused the debbugs.gnu.org bug report #68377,
regarding Cannot commit parts of *vc-diff* on Microsoft Windows
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
68377: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68377
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Sam Steingold <sds <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Cannot commit parts of *vc-diff* on Microsoft Windows
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!

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 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:
   * [`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`

# 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`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Specifying-Coding-Systems.html) when writing the patch.

Also, it does not seem reasonable that [`prefer-coding-system`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Output-Coding.html) does not affect [`file-coding-system-alist`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Default-Coding-Systems.html).



[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: sds <at> gnu.org
Cc: 68377-done <at> debbugs.gnu.org, dmitry <at> gutov.dev
Subject: Re: bug#68377: Cannot commit parts of *vc-diff* on Microsoft Windows
Date: Sat, 10 Feb 2024 10:06:45 +0200
> Cc: 68377 <at> debbugs.gnu.org, dmitry <at> gutov.dev
> Date: Sat, 27 Jan 2024 11:11:24 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> Ping!  Sam, would you please try this on the master branch?
> 
> > Cc: 68377 <at> debbugs.gnu.org, sds <at> gnu.org
> > Date: Sun, 14 Jan 2024 18:42:41 +0200
> > From: Eli Zaretskii <eliz <at> gnu.org>
> > 
> > > Date: Thu, 11 Jan 2024 17:07:48 +0200
> > > From: Dmitry Gutov <dmitry <at> gutov.dev>
> > > Cc: 68377 <at> debbugs.gnu.org, sds <at> gnu.org
> > > 
> > > On 11/01/2024 16:47, Eli Zaretskii wrote:
> > > >> Date: Thu, 11 Jan 2024 15:19:26 +0200
> > > >> Cc:68377 <at> debbugs.gnu.org
> > > >> From: Dmitry Gutov<dmitry <at> gutov.dev>
> > > >>
> > > >> On 11/01/2024 14:28, Eli Zaretskii wrote:
> > > >>>> From: Sam Steingold<sds <at> 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.
> > > > It isn't Markdown that bothered me, it's some kind of HTML mixed in,
> > > > but in an email message whose format is plain text (at least as I got
> > > > it here).
> > > 
> > > The <kbd> tags? These are also supported by Markdown. The links too.
> > > 
> > > >> 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).
> > > > Possibly.  If Sam says it works for him on master, we will know.
> > > 
> > > Yes, let's see what he says.
> > 
> > Sam, could you please chime in after testing this in Emacs 30?
> > 
> > Thanks.

No further comments within a month, so I presume the bug is indeed
fixed on master, and I'm therefore closing it.


This bug report was last modified 1 year and 155 days ago.

Previous Next


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