summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0ef617f)
raw | patch | inline | side by side (parent: 0ef617f)
author | Junio C Hamano <gitster@pobox.com> | |
Sat, 16 Feb 2008 07:57:26 +0000 (23:57 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 16 Feb 2008 07:57:26 +0000 (23:57 -0800) |
The command used a very old fashioned construct to extract
filenames out of diff-index and ended up corrupting the output.
We can simply use --name-only and pipe into --stdin mode of
update-index. It's been like that for the past 2 years or so
since a94d994 (update-index: work with c-quoted name).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
filenames out of diff-index and ended up corrupting the output.
We can simply use --name-only and pipe into --stdin mode of
update-index. It's been like that for the past 2 years or so
since a94d994 (update-index: work with c-quoted name).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-filter-branch.sh | patch | blob | history | |
t/t7003-filter-branch.sh | patch | blob | history |
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ff716cabb084526ddb5655c3b7c6dd02f4ed1b39..49e13f0bb1ed2bcb6e85455f24dffa912927d67a 100755 (executable)
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
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 ||
index 5f60b22d872b5d034e137e0c6c7c5a9d664e57ee..868babc4b2350526192a8df53f6cbec3f81c644e 100755 (executable)
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
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