From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#68377: Cannot commit parts of *vc-diff* on Microsoft Windows
Date: Thu, 11 Jan 2024 14:44:41 +0200
Message-ID: <83ply8kpja.fsf@gnu.org>
References: <87le8wy65p.fsf@gnu.org> <83r0iokq9q.fsf@gnu.org>
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="5337"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: 68377@debbugs.gnu.org
To: sds@gnu.org
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 11 13:46:18 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1rNuRt-00019a-M8
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Jan 2024 13:46:17 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1rNuRi-0007Om-68; Thu, 11 Jan 2024 07:46:06 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1rNuRg-0007Oa-LK
 for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 07:46:04 -0500
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1rNuRg-0003n4-C9
 for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 07:46:04 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rNuRd-0006TB-MX
 for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 07:46:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Eli Zaretskii <eliz@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 11 Jan 2024 12:46:01 +0000
Resent-Message-ID: <handler.68377.B68377.170497710818173@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 68377
X-GNU-PR-Package: emacs
Original-Received: via spool by 68377-submit@debbugs.gnu.org id=B68377.170497710818173
 (code B ref 68377); Thu, 11 Jan 2024 12:46:01 +0000
Original-Received: (at 68377) by debbugs.gnu.org; 11 Jan 2024 12:45:08 +0000
Original-Received: from localhost ([127.0.0.1]:58996 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1rNuQl-0004iR-DR
 for submit@debbugs.gnu.org; Thu, 11 Jan 2024 07:45:07 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59366)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@gnu.org>) id 1rNuQi-0004S4-JI
 for 68377@debbugs.gnu.org; Thu, 11 Jan 2024 07:45:05 -0500
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>)
 id 1rNuQf-00037Z-BR; Thu, 11 Jan 2024 07:45:01 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=zYNRh+qwdMYrRf3znT1TFzpkvjNXhY7mdC7a7LhKWig=; b=gRT4AKQLrEgp
 7EWnrUmFYCrHADBn29uwoZP2Nizjf3wRE1yusLEUehH6LlSpIYChvBMHt4nnq/xBFKFnaL3A60XHX
 MB6+mi3HIoDEgxWjs+GnEGPr26QYYd9/PgZBXTgNqkpQbQt7kXnMRihw14zT89GJ2YfuNooJmuJs7
 aKXV+YCumPeJ/PSCcQ7VOG4fs0aOpiKzGDMPNd1p1FsSgr6EkC4X5KzCzMxC/yTb7gQLSnRmFQi05
 f1Yp7GcMTYpfhbVJi5Gm6+6onP+8sj/KYJl1OLT3G6vU+CJMlCJatkGerql0OHbk7qrhm3NHHHWPM
 wPS0k1XrZGyVAcnmLdef6w==;
In-Reply-To: <83r0iokq9q.fsf@gnu.org> (message from Eli Zaretskii on Thu, 11
 Jan 2024 14:28:49 +0200)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:277890
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/277890>

> Cc: 68377@debbugs.gnu.org
> Date: Thu, 11 Jan 2024 14:28:49 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > # 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.

And sure enough, trying the recipe from "emacs -Q" fails to reproduce
the problem.  So there's something else at work here.

Could you please try this in "emacs -Q"?  If it doesn't work in
"emacs -Q", please step in Edebug through vc-git-checkin and tell
what you see as the value of coding-system-for-write when this code
is executed:

          (with-temp-file patch-file
            (insert vc-git-patch-string))

and also what is the EOL format of patch-file that Emacs creates
there, and let's take it from there.

If this does work in "emacs -Q", then some of your customizations
related to coding-systems probably get in the way.

FTR, in my case autocrlf is also false (as it should be).