Page MenuHomePhorge

Cannot patch a diff that edits files with non-ascii filenames
Open, HighPublic

Description

Steps to reproduce:

Create a repository in Phorge, and get its URL. In my case it's https://hub.sealcode.org/diffusion/ASCIIREPRO/non-ascii-filenames-repro.git

git clone https://hub.sealcode.org/diffusion/ASCIIREPRO/non-ascii-filenames-repro.git
cd non-ascii-filenames-repro.git
echo "2" >> "zażółć gęsią jaźń.txt"
git add .
git commit -a -m "Update"
arc diff

Then, get the Revision number, and run

git clone https://hub.sealcode.org/diffusion/ASCIIREPRO/non-ascii-filenames-repro.git
arc patch D123

The error says:

Created and checked out branch arcpatch-D1450.
Checking patch "\"a/za\\305\\274\\303\\263\\305\\202\\304\\207 g\\304\\231si\\304\\205 ja\\305\\272\\305\\204.txt\"" => "za\305\274\303\263\305\202\304\207 g\304\231si\304\205 ja\305\272\305\204.txt"...
error: "a/za\305\274\303\263\305\202\304\207 g\304\231si\304\205 ja\305\272\305\204.txt": does not exist in index

Event Timeline

I also faced this, tested @ D25623, and found out git format-patch was emitting that result which causes git apply to fail. See this git format-patch example.

1From ebdcaa8778a02b492eff2587c6120f2f5082df63 Mon Sep 17 00:00:00 2001
2From: Yongmin Hong <revi@omglol.email>
3Date: Sat, 11 May 2024 09:51:30 +0000
4Subject: [PATCH] Add
5
6Signed-off-by: Yongmin Hong <revi@omglol.email>
7---
8 "\355\205\214\354\212\244\355\212\270.md" | 1 +
9 1 file changed, 1 insertion(+)
10 create mode 100644 "\355\205\214\354\212\244\355\212\270.md"
11
12diff --git "a/\355\205\214\354\212\244\355\212\270.md" "b/\355\205\214\354\212\244\355\212\270.md"
13new file mode 100644
14index 0000000..6de7b8c
15--- /dev/null
16+++ "b/\355\205\214\354\212\244\355\212\270.md"
17@@ -0,0 +1 @@
18+This is a test file.
19--
202.32.7

Filename should have been 테스트.md.

workaround:

git config --global core.quotepath false

After the patch:

1From d2aa2b2f5aa290edec6a5fd141318a479ac9de8e Mon Sep 17 00:00:00 2001
2From: Yongmin Hong <revi@omglol.email>
3Date: Tue, 14 May 2024 15:15:52 +0000
4Subject: [PATCH] test commit
5
6---
7 테스트.txt | 1 +
8 1 file changed, 1 insertion(+)
9 create mode 100644 테스트.txt
10
11diff --git a/테스트.txt b/테스트.txt
12new file mode 100644
13index 0000000..86724be
14--- /dev/null
15+++ b/테스트.txt
16@@ -0,0 +1 @@
17+BlahBlah
18--
192.32.7

And applies on arc cleanly:

image.png (632×2 px, 75 KB)