From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Dmitry Gutov <dmitry@gutov.dev>
Newsgroups: gmane.emacs.bugs
Subject: bug#68377: Cannot commit parts of *vc-diff* on Microsoft Windows
Date: Thu, 11 Jan 2024 15:19:26 +0200
Message-ID: <65db305f-0606-445b-b034-fc069800a244@gutov.dev>
References: <87le8wy65p.fsf@gnu.org> <83r0iokq9q.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="21445"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Mozilla Thunderbird
Cc: 68377@debbugs.gnu.org
To: Eli Zaretskii <eliz@gnu.org>, sds@gnu.org
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 11 14:20:23 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 1rNuyq-0005Iq-Tu
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Jan 2024 14:20:21 +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 1rNuyc-0002bG-VV; Thu, 11 Jan 2024 08:20:07 -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 1rNuyb-0002aq-5T
 for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 08:20:05 -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 1rNuya-0004ZO-Sa
 for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 08:20: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 1rNuyY-0004zD-5K
 for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 08:20:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Dmitry Gutov <dmitry@gutov.dev>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 11 Jan 2024 13:20:02 +0000
Resent-Message-ID: <handler.68377.B68377.170497917619121@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.170497917619121
 (code B ref 68377); Thu, 11 Jan 2024 13:20:02 +0000
Original-Received: (at 68377) by debbugs.gnu.org; 11 Jan 2024 13:19:36 +0000
Original-Received: from localhost ([127.0.0.1]:59045 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1rNuy7-0004yL-L5
 for submit@debbugs.gnu.org; Thu, 11 Jan 2024 08:19:36 -0500
Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:34779)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@gutov.dev>) id 1rNuy5-0004y3-0A
 for 68377@debbugs.gnu.org; Thu, 11 Jan 2024 08:19:34 -0500
Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.nyi.internal (Postfix) with ESMTP id 3CF385C00EE;
 Thu, 11 Jan 2024 08:19:29 -0500 (EST)
Original-Received: from mailfrontend2 ([10.202.2.163])
 by compute2.internal (MEProxy); Thu, 11 Jan 2024 08:19:29 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm1; t=1704979169;
 x=1705065569; bh=yVIGdAikafgrHKy+yqkX3ED6E2A3Bj2o77dQ1WB7NOE=; b=
 CTnHWJHHkq3Uldx56uGavBSSmUFo6Sj+ZaquD7SQkscBpzdMf362xI1zdv1n6Oq0
 0aTwnPg8vmNw4AMsIl+B3GTZUgyzLqtZZpPpCA0tpsjp90g+zx059UL5STYyj93J
 J8CEGXagELx58Wh7pgeNFADy+VB/0hY9tFYznOx/+eDFwErjAc1RpDKtZVo9Z6jp
 aP+COxAQ5QHUgoj3v5Wl5NJK3ADHmlq2RxPmB+LjhzfxiVXTffKbw7cQFSHGEzsq
 tQJrb6H8BsxNBv1mVxbLG1D2gYAwFCPrgybQMorNOkqlrDXUmDq+6I3/wq+qA6x1
 t9jy5welUrXs9iYEAkaPaw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704979169; x=
 1705065569; bh=yVIGdAikafgrHKy+yqkX3ED6E2A3Bj2o77dQ1WB7NOE=; b=N
 mgp1Jf/JqxzoFh8gagdycER4MJ1bDvaZxTzF5PtNd/Y9FNJwCm/KviINQbUm6yuN
 UayBlUh0812hAmsdEgTQoCs2Gjrw4wjyRSMRPtngeMYk8S7aAeknmxLSw9qM+Q26
 +bpp3cCmMoVNGMZ1lcCaZ1XOUYYAAAo7jtf5My0SXr0Z+zZlPWmTRp8FMo5rC3bJ
 ooKxXXQ8gGG1Lo7XxKsXNvqu3AxL0yBU2en83bTmxc1FGil9Zr7+Cgq0cYtEvEyK
 j0MSrbTW9f66+U6ySIIfkuzUDeCPyVAqV57oP2VzOkgHk+y+V57jfVBwNNB38qe8
 NrRf/qPL+g1uISME4gY2Q==
X-ME-Sender: <xms:4eqfZWekyrj1MJajKX9Iiqg2qY8UwCYWmplT9F5BwR_BridShbIr-Q>
 <xme:4eqfZQOm5uZEeaW-gqL72tDOW1n_9DCwWg1zbw_eu6Sluuqwliq3XA3ccXJFC3bIJ
 E_BsCIHJcNs8y1aTk8>
X-ME-Received: <xmr:4eqfZXi5fyWBQwo4Oy_YdUrtXlTq_eLNqGA0q6-1qSDV8CQc8sujFTxWu2nBF66-aGt->
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeifedghedtucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepvdffgfeltdejleetvdejkeejkeelleefgeeuveelkeegvdekueegfeekfedv
 jeejnecuffhomhgrihhnpehsthgrtghkvgigtghhrghnghgvrdgtohhmpdhgnhhurdhorh
 hgpdhgihhtfhhorhifihhnughofihsrdhorhhgnecuvehluhhsthgvrhfuihiivgeptden
 ucfrrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:4eqfZT80hweQYeWaFqf_FeocXX1Hc1dmzs5kteXxYxoHQg41x6axmg>
 <xmx:4eqfZSud2bULVR1rQLBJkWp2AS86G0n5j4mEWz1q_NTxsxrU0k7_PQ>
 <xmx:4eqfZaEpZ58WWAtyvNXgNPM2UM1lWUygxIsz2ABuDeXXW2821hiAoA>
 <xmx:4eqfZXXoUrvt_cylNDxcuX8vL6Iu2L_Jg24KQ-dbv6V0DVVb1EHIOQ>
Feedback-ID: i0e71465a:Fastmail
Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 11 Jan 2024 08:19:27 -0500 (EST)
Content-Language: en-US
In-Reply-To: <83r0iokq9q.fsf@gnu.org>
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:277893
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/277893>

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 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`
> 
> 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).