@matheusbsbs / matheus-bagliano / commits / 17f26a9ee3
Fork 0

git-am: fix shell quoting

Noticed by Stephan Beyer; the new test is mine. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jan 14, 2009 at 16:29 UTC 17f26a9ee3298dfa0a1df7cd4e5f5f32342e5f62
2 files changed +9 -1
git-am.sh
+1 -1
@@ -38,7 +38,7 @@ sq () {
38 for sqarg
39 do
40 printf "%s" "$sqarg" |
41 - sed -e 's/'\''/'\''\'\'''\''/g' -e 's/.*/ '\''&'\''/'
41 + sed -e 's/'\''/'\''\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
42 done
43 }
44
t/t4252-am-options.sh
+8
@@ -58,4 +58,12 @@ test_expect_success 'interrupted am --directory="frotz nitfol"' '
58 grep One "frotz nitfol/file-5"
59 '
60
61 +test_expect_success 'apply to a funny path' '
62 + with_sq="with'\''sq"
63 + rm -fr .git/rebase-apply &&
64 + git reset --hard initial &&
65 + git am --directory="$with_sq" "$tm"/am-test-5-2 &&
66 + test -f "$with_sq/file-5"
67 +'
68 +
69 test_done