git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2008, 07:54 UTC
Message-ID
<7v63wpcp4o.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<87tzk9tnnu.dlv@maison.homelinux.org>

Not just those two lines but the next two lines were also very old fashioned.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * Could you try this one?
 git-filter-branch.sh     |    9 +++++----
 t/t7003-filter-branch.sh |   14 ++++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ff716ca..49e13f0 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -276,10 +276,11 @@ while read commit parents; do
 		eval "$filter_tree" < /dev/null ||
 			die "tree filter failed: $filter_tree"
 
-		git diff-index -r $commit | cut -f 2- | tr '\012' '\000' | \
-			xargs -0 git update-index --add --replace --remove
-		git ls-files -z --others | \
-			xargs -0 git update-index --add --replace --remove
+		(
+			git diff-index -r --name-only $commit
+			git ls-files --others
+		) |
+		git update-index --add --replace --remove --stdin
 	fi
 
 	eval "$filter_index" < /dev/null ||
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 5f60b22..868babc 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -165,4 +165,18 @@ test_expect_success '"map" works in commit filter' '
 	git rev-parse --verify master
 '
 
+test_expect_success 'Name needing quotes' '
+
+	git checkout -b rerere A &&
+	mkdir foo &&
+	name="れれれ" &&
+	>foo/$name &&
+	git add foo &&
+	git commit -m "Adding a file" &&
+	git filter-branch --tree-filter "rm -fr foo" &&
+	! git ls-files --error-unmatch "foo/$name" &&
+	test $(git rev-parse --verify rerere) != $(git rev-parse --verify A)
+
+'
+
 test_done
Previous: Remi VanicatNext: Remi Vanicat
Message 8 of 9 in “[BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename”
  1. Remi VanicatFeb 15, 2008
  2. Junio C HamanoFeb 15, 2008
  3. Johannes SchindelinFeb 15, 2008
  4. Junio C HamanoFeb 15, 2008
  5. Johannes SchindelinFeb 16, 2008
  6. Johannes SchindelinFeb 16, 2008
  7. Remi VanicatFeb 16, 2008
  8. Junio C HamanoFeb 16, 2008
  9. Remi VanicatFeb 16, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.