Skip to content

git diff cannot handle paths with escaped characters when core.quotepath=on #3843

Description

@liuxingbaoyu
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.36.0.windows.1
cpu: x86_64
built from commit: ea1e13f73339d57cbe81a0bae6fba669aaccf656
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [版本 10.0.22000.652]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: VisualStudioCode
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

When core.quotepath=on, git diff cannot handle paths with escaped characters.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

cmd/ps

git diff C:/Users/流星暴雨/AppData/Local/Temp/xfs-eae3abb5/source C:/Users/流星暴雨/AppData/Local/Temp/xfs-eae3abb5/user
  • What did you expect to occur after running these commands?
diff --git "a/index.js" "b/index.js"
index 0058c5af4c6a50c89029ee8a8764590e1055658d..4c74ee6305af188e65de06156344d5af7b537dec 100644
--- "a/index.js"
+++ "b/index.js"
  • What actually happened instead?
diff --git "a/C:/Users/\346\265\201\346\230\237\346\232\264\351\233\250/AppData/Local/Temp/xfs-eae3abb5/source/index.js" "b/C:/Users/\346\265\201\346\230\237\346\232\264\351\233\250/AppData/Local/Temp/xfs-eae3abb5/user/index.js"
index 0058c5af4c6a50c89029ee8a8764590e1055658d..4c74ee6305af188e65de06156344d5af7b537dec 100644
--- "a/C:/Users/\346\265\201\346\230\237\346\232\264\351\233\250/AppData/Local/Temp/xfs-eae3abb5/source/index.js"
+++ "b/C:/Users/\346\265\201\346\230\237\346\232\264\351\233\250/AppData/Local/Temp/xfs-eae3abb5/user/index.js"
  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

** insert URL here **

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions