Subject: bug#65049: 29.1; vc-do-command fails in windows emacs 29.1

From: Maxim Kim <[email-masked]>
Date: Fri, 04 Aug 2023 17:50:25 +1000

In a git repository with at least single change:

0. ./runemacs.exe -Q
1. navigate to a dirty git repo
2. C-x v D
3. Add commit message
4. Press C-x v v

As a result I have following error in *Messages*:

    vc-do-command: Failed (status 1): git --no-pager apply --cached
    ../AppData/Local/Temp/git-patchTK9GGr

and in *vc*

    error: patch failed: notes.org:1
    error: notes.org: patch does not apply

If I do C-x v v from within C-x v d RET or directly from changed file --
it works fine, changes are commiteed.

In GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-08-03 built on
 AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.22621
System Description: Microsoft Windows 10 Pro (v10.0.2009.22621.1992)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation=aot
 --without-compress-install --with-tree-sitter CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

(NATIVE_COMP present but libgccjit not available)

Important settings:
  value of $LANG: ENA
  locale-coding-system: cp1252

Major mode: ERC

Minor modes in effect:
  windmove-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-netsplit-mode: t
  erc-hl-nicks-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-networks-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  corfu-popupinfo-mode: t
  corfu-echo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  vertico-mode: t
  override-global-mode: t
  pixel-scroll-precision-mode: t
  repeat-mode: t
  savehist-mode: t
  save-place-mode: t
  delete-selection-mode: t
  electric-pair-mode: t
  recentf-mode: t
  winner-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
c:/Users/maxim.kim/.emacs.d/elpa/transient-20230723.1411/transient hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/transient
c:/Users/maxim.kim/.emacs.d/elpa/jsonrpc-1.0.17/jsonrpc hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/jsonrpc
c:/Users/maxim.kim/.emacs.d/elpa/use-package-20230426.2324/use-package hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/use-package/use-package
c:/Users/maxim.kim/.emacs.d/elpa/use-package-20230426.2324/use-package-lint hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/use-package/use-package-lint
c:/Users/maxim.kim/.emacs.d/elpa/use-package-20230426.2324/use-package-jump hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/use-package/use-package-jump
c:/Users/maxim.kim/.emacs.d/elpa/use-package-20230426.2324/use-package-ensure hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/use-package/use-package-ensure
c:/Users/maxim.kim/.emacs.d/elpa/use-package-20230426.2324/use-package-diminish hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/use-package/use-package-diminish
c:/Users/maxim.kim/.emacs.d/elpa/use-package-20230426.2324/use-package-delight hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/use-package/use-package-delight
c:/Users/maxim.kim/.emacs.d/elpa/use-package-20230426.2324/use-package-core hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/use-package/use-package-core
c:/Users/maxim.kim/.emacs.d/elpa/use-package-20230426.2324/use-package-bind-key hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/use-package/use-package-bind-key
c:/Users/maxim.kim/.emacs.d/elpa/bind-key-20230203.2004/bind-key hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/use-package/bind-key
c:/Users/maxim.kim/.emacs.d/elpa/eglot-1.15/eglot hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/progmodes/eglot
c:/Users/maxim.kim/.emacs.d/elpa/eldoc-1.14.0/eldoc hides c:/Program Files/Emacs/emacs-29.1/share/emacs/29.1/lisp/emacs-lisp/eldoc

Features:
(shadow sort mail-extr emacsbug sh-script smie executable oc-basic
bibtex project embark-org org-element org-persist xdg org-id org-refile
avl-tree generator habamax-org org ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-macro org-src ob-comint org-pcomplete org-list org-footnote
org-faces org-entities ob-emacs-lisp ob-core ob-eval org-cycle org-table
ol org-fold org-fold-core org-keys oc org-loaddefs cal-menu calendar
cal-loaddefs org-version org-compat org-macs misearch multi-isearch
marginalia-autoloads noutline outline markdown-mode-autoloads let-alist
finder find-func loaddefs-gen lisp-mnt radix-tree tar-mode arc-mode
archive-mode mm-archive cus-edit cus-start cus-load gnutls url-cache
url-http url-auth url-gw display-line-numbers finder-inf windmove
compile consult-imenu network-stream nsm epa-file erc-list erc-menu
erc-join erc-ring erc-pcomplete erc-track erc-match erc-netsplit
habamax-erc erc-hl-nicks color erc-button erc-fill erc-stamp erc-goodies
erc iso8601 erc-backend erc-networks erc-common erc-compat erc-loaddefs
embark-consult embark ffap thingatpt c-ts-mode c-ts-common treesit
ibuffer ibuffer-loaddefs vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs
vc-rcs log-view vc bug-reference face-remap magit-extras magit-bookmark
magit-submodule magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff git-commit log-edit message sendmail yank-media puny
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process with-editor comp comp-cstr
warnings icons rx shell pcomplete comint ansi-osc server ansi-color
magit-mode transient magit-git magit-base magit-section format-spec
cursor-sensor crm dash hl-line mule-util orderless consult bookmark
text-property-search pp dired-aux dired dired-loaddefs time-date
wildcharm-light-theme vc-git diff-mode vc-dispatcher habamax time
rainbow-delimiters corfu-popupinfo corfu-echo corfu marginalia vertico
compat use-package-ensure habamax-windows edmacro kmacro cl-extra
help-mode use-package-bind-key bind-key easy-mmode use-package-core
pixel-scroll cua-base repeat savehist saveplace delsel elec-pair recentf
tree-widget wid-edit winner ring elfeed-autoloads
embark-consult-autoloads consult-autoloads embark-autoloads
emms-autoloads magit-autoloads pcase git-commit-autoloads
magit-section-autoloads orderless-autoloads package-lint-autoloads
tempel-autoloads info compat-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib
wildcharm-theme rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32
ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads
w32notify w32 lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 1970441 140565)
 (symbols 48 38478 4)
 (strings 32 327848 23134)
 (string-bytes 1 10987056)
 (vectors 16 104264)
 (vector-slots 8 2294926 86450)
 (floats 8 466 392)
 (intervals 56 208319 1817)
 (buffers 984 49))