OSDN Git Service

git-am: fix shell quoting
authorJunio C Hamano <gitster@pobox.com>
Thu, 15 Jan 2009 00:29:59 +0000 (16:29 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Jan 2009 00:29:59 +0000 (16:29 -0800)
Noticed by Stephan Beyer; the new test is mine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-am.sh
t/t4252-am-options.sh

index 7e6329b..4beb12d 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -38,7 +38,7 @@ sq () {
        for sqarg
        do
                printf "%s" "$sqarg" |
-               sed -e 's/'\''/'\''\'\'''\''/g' -e 's/.*/ '\''&'\''/'
+               sed -e 's/'\''/'\''\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
        done
 }
 
index e91a6da..5fdd188 100755 (executable)
@@ -58,4 +58,12 @@ test_expect_success 'interrupted am --directory="frotz nitfol"' '
        grep One "frotz nitfol/file-5"
 '
 
+test_expect_success 'apply to a funny path' '
+       with_sq="with'\''sq"
+       rm -fr .git/rebase-apply &&
+       git reset --hard initial &&
+       git am --directory="$with_sq" "$tm"/am-test-5-2 &&
+       test -f "$with_sq/file-5"
+'
+
 test_done