From: Junio C Hamano Date: Thu, 15 Jan 2009 00:29:59 +0000 (-0800) Subject: git-am: fix shell quoting X-Git-Tag: v1.6.2-rc0~111^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=17f26a9ee3298dfa0a1df7cd4e5f5f32342e5f62;p=git-core%2Fgit.git git-am: fix shell quoting Noticed by Stephan Beyer; the new test is mine. Signed-off-by: Junio C Hamano --- diff --git a/git-am.sh b/git-am.sh index 7e6329b14..4beb12dcf 100755 --- 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 } diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh index e91a6da0d..5fdd18858 100755 --- a/t/t4252-am-options.sh +++ b/t/t4252-am-options.sh @@ -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