Skip to content

Commit 17f26a9

Browse files
committed
git-am: fix shell quoting
Noticed by Stephan Beyer; the new test is mine. Signed-off-by: Junio C Hamano <[email protected]>
1 parent b47dfe9 commit 17f26a9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

git-am.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ sq () {
3838
for sqarg
3939
do
4040
printf "%s" "$sqarg" |
41-
sed -e 's/'\''/'\''\'\'''\''/g' -e 's/.*/ '\''&'\''/'
41+
sed -e 's/'\''/'\''\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
4242
done
4343
}
4444

t/t4252-am-options.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,12 @@ test_expect_success 'interrupted am --directory="frotz nitfol"' '
5858
grep One "frotz nitfol/file-5"
5959
'
6060

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+
6169
test_done

0 commit comments

Comments
 (0)