Subject: Re: bug#65049: Minor update to the repro steps

From: Eli Zaretskii <[email-masked]>
Date: Thu, 24 Aug 2023 07:54:58 +0300

> Date: Wed, 23 Aug 2023 23:13:18 +0300
> Cc: [email-masked], [email-masked]
> From: Dmitry Gutov <[email-masked]>
> 
> > Dmitry, do you see any problems with installing this on the release
> > branch?  Or do you prefer to keep it on master for a while, and then
> > backport if no one complains?
> 
> It doesn't look "obviously correct" to me, and I'm no pro in the coding 
> system department.
> 
> If the patch shouldn't affect non-Windows systems (which seems to be 
> clear for the second hunk, but not for the first one), I'd say we test 
> (and ask to test) several orthogonal scenarios: when the system is in 
> the standard language environment, and when it's in the "unixy" one. And 
> the same regarding the repository.

See below.

> If everything's okay, maybe it's good for emacs-29. It will have a few 
> months to stabilize, right?

For some, hopefully small, value of "few", yes.

> Just as long as the patch goes into master too (that's where the
> bulk of the stabilization will happen, since we have generally
> switched to that branch now for daily use).

OK.

> > diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
> > index 7ae763d..218696c 100644
> > --- a/lisp/vc/vc-git.el
> > +++ b/lisp/vc/vc-git.el
> > @@ -1051,7 +1051,15 @@ vc-git-checkin
> >                   (user-error "Index not empty"))
> >                 (setq pos (point))))))
> >         (unless (string-empty-p vc-git-patch-string)
> > -        (let ((patch-file (make-nearby-temp-file "git-patch")))
> > +        (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)))
> 
> Any chance this change could negatively affect non-Windows systems? Is 
> it a given that the 'unix' line endings are always used there?

Yes, that should be the case.  If you will be more happy with making
this a Windows-only change, I can do that.  But before I do, could you
please try the recipe here:

   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65049#68

but with the following change in step 4:

  4. C-x RET f utf-8-dos RET

That is, try the recipe on a Posix host with a file whose EOL format
is CRLF.  If that works without any changes in the current VC code, I
will be happy to make the first hunk Windows-specific.

> (All the coding system juggling in these files is already too scary for 
> my taste, but I don't have any better suggestions.)

Neither do I.