From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sam Steingold <sds@gnu.org> Newsgroups: gmane.emacs.bugs Subject: bug#68377: Cannot commit parts of *vc-diff* on Microsoft Windows Date: Wed, 10 Jan 2024 21:07:14 -0500 Message-ID: <87le8wy65p.fsf@gnu.org> Reply-To: sds@gnu.org Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7663"; mail-complaints-to="usenet@ciao.gmane.io" To: 68377@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 11 03:08:26 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 1rNkUc-0001mo-3h for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Jan 2024 03:08:26 +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 1rNkUH-0004ZJ-4l; Wed, 10 Jan 2024 21:08:05 -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 1rNkUG-0004Z7-4c for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 21:08: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 1rNkUF-0006w9-S3 for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 21:08:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rNkUE-0003S6-AT for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 21:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sam Steingold <sds@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 02:08:02 +0000 Resent-Message-ID: <handler.68377.B.170493884913216@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68377 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170493884913216 (code B ref -1); Thu, 11 Jan 2024 02:08:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Jan 2024 02:07:29 +0000 Original-Received: from localhost ([127.0.0.1]:43614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1rNkTh-0003R5-3m for submit@debbugs.gnu.org; Wed, 10 Jan 2024 21:07:29 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:35716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sam.steingold@gmail.com>) id 1rNkTe-0003Qr-W3 for submit@debbugs.gnu.org; Wed, 10 Jan 2024 21:07:27 -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 <sam.steingold@gmail.com>) id 1rNkTa-0004L8-8E for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 21:07:22 -0500 Original-Received: from mail-qv1-xf32.google.com ([2607:f8b0:4864:20::f32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <sam.steingold@gmail.com>) id 1rNkTX-0006VS-Op; Wed, 10 Jan 2024 21:07:21 -0500 Original-Received: by mail-qv1-xf32.google.com with SMTP id 6a1803df08f44-680a06cc763so31190156d6.1; Wed, 10 Jan 2024 18:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704938836; x=1705543636; darn=gnu.org; h=mime-version:message-id:date:reply-to:return-receipt-to:subject:to :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=QM8OJlK70ZjMfjX/sllXDTd9kYztjrZHM5UzpeXLDxk=; b=HjfL63e2oGDvRG+cg4ztyGfLdVVxrDqY5N3AP8n+Irgn4vj1mwO3Fet61tPQFUR1mB bxHHVR1Xl90n224R2J8nG4TcoPpPa7g3RWxNNpQQq2sH+csYlQ0IBAetNT8Ru+wqPUif Xl6vEV8EYJ3Bz+x0fqPHsvn8O/Qo7SG3wloWpjnAobzWIY8w6mEl5FDyBnC8LbkeC+BG 5OyxOhhKxubjUve5PG2+sRxFThBLxersumNgOzWEHz2JDHB4Tq16XHlXKPs1jE6NWttc ypXNdAGPZMeL9GTf8NB/+eJrxj87EImYeQXs5mTKcLY3Krmjswlyf1OQb8MnKBHGjF5J yUPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704938836; x=1705543636; h=mime-version:message-id:date:reply-to:return-receipt-to:subject:to :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QM8OJlK70ZjMfjX/sllXDTd9kYztjrZHM5UzpeXLDxk=; b=ATPAr8G/1VCyS+3JdJIAAmgFQbz6ztmqM9ls9Wm9mQfc/i6WzOEs3Vd4O7freluTgm UDsNHv+t3iWsPOikKKaZTFnVhazQgVmYiLOeG6nHpqOqVB9TKmdopR2pSJeqUkOyDpUW 8WKaHAf3lEsY0nbc9Lq29KR6Y/avcFx1OQMnAY68EAvLYJ9xm7ZlX5hasO8qnlgB3YL5 YRCRKC2y6XQ7ajBR5dYCpPNPHSII2gISNGF2n64fxLVCyDApSF12IDAvGCr52wyZQsKW sD3jgSX0gpj8Jcv+kZK1VQE+FbDPFwIkFyTcqqd1alSTANPD4LB9TzgXxZrRdowmu38i +WJw== X-Gm-Message-State: AOJu0YykZ1QPM6bF+r0Em2gFIp21wn2sFKJdaSrMw7GW4u91MoO6nQrw AcL3XcLJNNtiNOSXv2uFG9yNbJylzw== X-Google-Smtp-Source: AGHT+IFnefhC2ZONfkS4UQTU8aZZvavA+Fh6aM3fC2ERdtOzXuZRl89PiJwkNuZVpuIq7UBKbyQ+Hw== X-Received: by 2002:a05:6214:248b:b0:67f:c76:e9e8 with SMTP id gi11-20020a056214248b00b0067f0c76e9e8mr535542qvb.16.1704938836095; Wed, 10 Jan 2024 18:07:16 -0800 (PST) Original-Received: from pop-os (pool-108-6-133-45.nycmny.fios.verizon.net. [108.6.133.45]) by smtp.gmail.com with ESMTPSA id do7-20020a056214096700b006810e650503sm2138814qvb.80.2024.01.10.18.07.14 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 18:07:15 -0800 (PST) X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. Received-SPF: pass client-ip=2607:f8b0:4864:20::f32; envelope-from=sam.steingold@gmail.com; helo=mail-qv1-xf32.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, WEIRD_PORT=0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:277857 Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/277857> 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).