fix portability issues with $ in double quotes
Using a dollar sign in double quotes isn't portable. Escape them with a backslash or replace the double quotes with single quotes. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
24072c0256
commit
9524cf2993
@ -462,11 +462,11 @@ if [ "$filter_tag_name" ]; then
|
||||
"$new_sha1" "$new_ref"
|
||||
git cat-file tag "$ref" |
|
||||
sed -n \
|
||||
-e "1,/^$/{
|
||||
-e '1,/^$/{
|
||||
/^object /d
|
||||
/^type /d
|
||||
/^tag /d
|
||||
}" \
|
||||
}' \
|
||||
-e '/^-----BEGIN PGP SIGNATURE-----/q' \
|
||||
-e 'p' ) |
|
||||
git mktag) ||
|
||||
|
@ -320,7 +320,7 @@ EOF
|
||||
else
|
||||
# plain-old CGI
|
||||
resolve_full_httpd
|
||||
list_mods=$(echo "$full_httpd" | sed "s/-f$/-l/")
|
||||
list_mods=$(echo "$full_httpd" | sed 's/-f$/-l/')
|
||||
$list_mods | sane_grep 'mod_cgi\.c' >/dev/null 2>&1 || \
|
||||
if test -f "$module_path/mod_cgi.so"
|
||||
then
|
||||
|
@ -407,7 +407,7 @@ update_squash_messages () {
|
||||
}
|
||||
|
||||
peek_next_command () {
|
||||
sed -n -e "/^#/d" -e "/^$/d" -e "s/ .*//p" -e "q" < "$TODO"
|
||||
sed -n -e "/^#/d" -e '/^$/d' -e "s/ .*//p" -e "q" < "$TODO"
|
||||
}
|
||||
|
||||
# A squash/fixup has failed. Prepare the long version of the squash
|
||||
|
@ -32,8 +32,8 @@ test_expect_success rebase '
|
||||
|
||||
git checkout side &&
|
||||
git rebase master &&
|
||||
git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
|
||||
git cat-file commit side@{1} | sed -e "1,/^$/d" >expect &&
|
||||
git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
|
||||
git cat-file commit side@{1} | sed -e "1,/^\$/d" >expect &&
|
||||
test_cmp expect actual
|
||||
|
||||
'
|
||||
|
@ -93,9 +93,9 @@ test_expect_success 'extra headers' '
|
||||
git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>
|
||||
" &&
|
||||
git format-patch --stdout master..side > patch2 &&
|
||||
sed -e "/^$/q" patch2 > hdrs2 &&
|
||||
grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs2 &&
|
||||
grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs2
|
||||
sed -e "/^\$/q" patch2 > hdrs2 &&
|
||||
grep "^To: R. E. Cipient <rcipient@example.com>\$" hdrs2 &&
|
||||
grep "^Cc: S. E. Cipient <scipient@example.com>\$" hdrs2
|
||||
|
||||
'
|
||||
|
||||
@ -104,9 +104,9 @@ test_expect_success 'extra headers without newlines' '
|
||||
git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
|
||||
git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>" &&
|
||||
git format-patch --stdout master..side >patch3 &&
|
||||
sed -e "/^$/q" patch3 > hdrs3 &&
|
||||
grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs3 &&
|
||||
grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs3
|
||||
sed -e "/^\$/q" patch3 > hdrs3 &&
|
||||
grep "^To: R. E. Cipient <rcipient@example.com>\$" hdrs3 &&
|
||||
grep "^Cc: S. E. Cipient <scipient@example.com>\$" hdrs3
|
||||
|
||||
'
|
||||
|
||||
@ -115,32 +115,32 @@ test_expect_success 'extra headers with multiple To:s' '
|
||||
git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
|
||||
git config --add format.headers "To: S. E. Cipient <scipient@example.com>" &&
|
||||
git format-patch --stdout master..side > patch4 &&
|
||||
sed -e "/^$/q" patch4 > hdrs4 &&
|
||||
grep "^To: R. E. Cipient <rcipient@example.com>,$" hdrs4 &&
|
||||
grep "^ *S. E. Cipient <scipient@example.com>$" hdrs4
|
||||
sed -e "/^\$/q" patch4 > hdrs4 &&
|
||||
grep "^To: R. E. Cipient <rcipient@example.com>,\$" hdrs4 &&
|
||||
grep "^ *S. E. Cipient <scipient@example.com>\$" hdrs4
|
||||
'
|
||||
|
||||
test_expect_success 'additional command line cc' '
|
||||
|
||||
git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
|
||||
git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^$/q" >patch5 &&
|
||||
grep "^Cc: R. E. Cipient <rcipient@example.com>,$" patch5 &&
|
||||
grep "^ *S. E. Cipient <scipient@example.com>$" patch5
|
||||
git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch5 &&
|
||||
grep "^Cc: R. E. Cipient <rcipient@example.com>,\$" patch5 &&
|
||||
grep "^ *S. E. Cipient <scipient@example.com>\$" patch5
|
||||
'
|
||||
|
||||
test_expect_success 'command line headers' '
|
||||
|
||||
git config --unset-all format.headers &&
|
||||
git format-patch --add-header="Cc: R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^$/q" >patch6 &&
|
||||
grep "^Cc: R. E. Cipient <rcipient@example.com>$" patch6
|
||||
git format-patch --add-header="Cc: R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch6 &&
|
||||
grep "^Cc: R. E. Cipient <rcipient@example.com>\$" patch6
|
||||
'
|
||||
|
||||
test_expect_success 'configuration headers and command line headers' '
|
||||
|
||||
git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
|
||||
git format-patch --add-header="Cc: S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^$/q" >patch7 &&
|
||||
grep "^Cc: R. E. Cipient <rcipient@example.com>,$" patch7 &&
|
||||
grep "^ *S. E. Cipient <scipient@example.com>$" patch7
|
||||
git format-patch --add-header="Cc: S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch7 &&
|
||||
grep "^Cc: R. E. Cipient <rcipient@example.com>,\$" patch7 &&
|
||||
grep "^ *S. E. Cipient <scipient@example.com>\$" patch7
|
||||
'
|
||||
|
||||
test_expect_success 'multiple files' '
|
||||
@ -406,9 +406,9 @@ test_expect_success 'cover-letter inherits diff options' '
|
||||
git mv file foo &&
|
||||
git commit -m foo &&
|
||||
git format-patch --cover-letter -1 &&
|
||||
! grep "file => foo .* 0 *$" 0000-cover-letter.patch &&
|
||||
! grep "file => foo .* 0 *\$" 0000-cover-letter.patch &&
|
||||
git format-patch --cover-letter -1 -M &&
|
||||
grep "file => foo .* 0 *$" 0000-cover-letter.patch
|
||||
grep "file => foo .* 0 *\$" 0000-cover-letter.patch
|
||||
|
||||
'
|
||||
|
||||
@ -425,7 +425,7 @@ EOF
|
||||
test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
|
||||
|
||||
git format-patch --cover-letter -2 &&
|
||||
sed -e "1,/A U Thor/d" -e "/^$/q" < 0000-cover-letter.patch > output &&
|
||||
sed -e "1,/A U Thor/d" -e "/^\$/q" < 0000-cover-letter.patch > output &&
|
||||
test_cmp expect output
|
||||
|
||||
'
|
||||
@ -450,7 +450,7 @@ EOF
|
||||
test_expect_success 'format-patch respects -U' '
|
||||
|
||||
git format-patch -U4 -2 &&
|
||||
sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
|
||||
sed -e "1,/^\$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
|
||||
test_cmp expect output
|
||||
|
||||
'
|
||||
@ -471,7 +471,7 @@ EOF
|
||||
test_expect_success 'format-patch -p suppresses stat' '
|
||||
|
||||
git format-patch -p -2 &&
|
||||
sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
|
||||
sed -e "1,/^\$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
|
||||
test_cmp expect output
|
||||
|
||||
'
|
||||
|
@ -37,11 +37,11 @@ test_expect_success setup '
|
||||
# patch-2 is the same as patch-1 but is based
|
||||
# on a version that already has whitespace fixed,
|
||||
# and does not introduce whitespace breakages.
|
||||
sed -e "s/ $//" patch-1 >patch-2 &&
|
||||
sed -e "s/ \$//" patch-1 >patch-2 &&
|
||||
|
||||
# If all whitespace breakages are fixed the contents
|
||||
# should look like file-fixed
|
||||
sed -e "s/ $//" file-1 >file-fixed
|
||||
sed -e "s/ \$//" file-1 >file-fixed
|
||||
|
||||
'
|
||||
|
||||
|
@ -302,7 +302,7 @@ test_expect_success 'am --committer-date-is-author-date' '
|
||||
git checkout first &&
|
||||
test_tick &&
|
||||
git am --committer-date-is-author-date patch1 &&
|
||||
git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
|
||||
git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
|
||||
at=$(sed -ne "/^author /s/.*> //p" head1) &&
|
||||
ct=$(sed -ne "/^committer /s/.*> //p" head1) &&
|
||||
test "$at" = "$ct"
|
||||
@ -312,7 +312,7 @@ test_expect_success 'am without --committer-date-is-author-date' '
|
||||
git checkout first &&
|
||||
test_tick &&
|
||||
git am patch1 &&
|
||||
git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
|
||||
git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
|
||||
at=$(sed -ne "/^author /s/.*> //p" head1) &&
|
||||
ct=$(sed -ne "/^committer /s/.*> //p" head1) &&
|
||||
test "$at" != "$ct"
|
||||
@ -326,7 +326,7 @@ test_expect_success 'am --ignore-date' '
|
||||
git checkout first &&
|
||||
test_tick &&
|
||||
git am --ignore-date patch1 &&
|
||||
git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
|
||||
git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
|
||||
at=$(sed -ne "/^author /s/.*> //p" head1) &&
|
||||
echo "$at" | grep "+0000"
|
||||
'
|
||||
|
@ -255,7 +255,7 @@ EOF
|
||||
|
||||
test_expect_success 'log --graph with merge' '
|
||||
git log --graph --date-order --pretty=tformat:%s |
|
||||
sed "s/ *$//" >actual &&
|
||||
sed "s/ *\$//" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
@ -315,7 +315,7 @@ EOF
|
||||
test_expect_success 'log --graph with full output' '
|
||||
git log --graph --date-order --pretty=short |
|
||||
git name-rev --name-only --stdin |
|
||||
sed "s/Merge:.*/Merge: A B/;s/ *$//" >actual &&
|
||||
sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
@ -383,7 +383,7 @@ EOF
|
||||
|
||||
test_expect_success 'log --graph with merge' '
|
||||
git log --graph --date-order --pretty=tformat:%s |
|
||||
sed "s/ *$//" >actual &&
|
||||
sed "s/ *\$//" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
|
@ -146,8 +146,8 @@ test_expect_success 'binary files cannot be merged' '
|
||||
grep "Cannot merge binary files" merge.err
|
||||
'
|
||||
|
||||
sed -e "s/deerit.$/deerit;/" -e "s/me;$/me./" < new5.txt > new6.txt
|
||||
sed -e "s/deerit.$/deerit,/" -e "s/me;$/me,/" < new5.txt > new7.txt
|
||||
sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" < new5.txt > new6.txt
|
||||
sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" < new5.txt > new7.txt
|
||||
|
||||
test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '
|
||||
|
||||
|
@ -150,7 +150,7 @@ EOF
|
||||
test_expect_success '--signoff' '
|
||||
echo "yet another content *narf*" >> foo &&
|
||||
echo "zort" | git commit -s -F - foo &&
|
||||
git cat-file commit HEAD | sed "1,/^$/d" > output &&
|
||||
git cat-file commit HEAD | sed "1,/^\$/d" > output &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
|
@ -186,8 +186,8 @@ test_expect_success 'Prompting works' '
|
||||
--smtp-server="$(pwd)/fake.sendmail" \
|
||||
$patches \
|
||||
2>errors &&
|
||||
grep "^From: Example <from@example.com>$" msgtxt1 &&
|
||||
grep "^To: to@example.com$" msgtxt1
|
||||
grep "^From: Example <from@example.com>\$" msgtxt1 &&
|
||||
grep "^To: to@example.com\$" msgtxt1
|
||||
'
|
||||
|
||||
test_expect_success 'cccmd works' '
|
||||
@ -236,7 +236,7 @@ test_expect_success 'Author From: in message body' '
|
||||
--to=nobody@example.com \
|
||||
--smtp-server="$(pwd)/fake.sendmail" \
|
||||
$patches &&
|
||||
sed "1,/^$/d" < msgtxt1 > msgbody1
|
||||
sed "1,/^\$/d" < msgtxt1 > msgbody1
|
||||
grep "From: A <author@example.com>" msgbody1
|
||||
'
|
||||
|
||||
@ -247,7 +247,7 @@ test_expect_success 'Author From: not in message body' '
|
||||
--to=nobody@example.com \
|
||||
--smtp-server="$(pwd)/fake.sendmail" \
|
||||
$patches &&
|
||||
sed "1,/^$/d" < msgtxt1 > msgbody1
|
||||
sed "1,/^\$/d" < msgtxt1 > msgbody1
|
||||
! grep "From: A <author@example.com>" msgbody1
|
||||
'
|
||||
|
||||
|
@ -96,7 +96,7 @@ EOF
|
||||
|
||||
test_expect_success 'pserver authentication' \
|
||||
'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU$"'
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
||||
|
||||
test_expect_success 'pserver authentication failure (non-anonymous user)' \
|
||||
'if cat request-git | git-cvsserver pserver >log 2>&1
|
||||
@ -105,11 +105,11 @@ test_expect_success 'pserver authentication failure (non-anonymous user)' \
|
||||
else
|
||||
true
|
||||
fi &&
|
||||
sed -ne \$p log | grep "^I HATE YOU$"'
|
||||
sed -ne \$p log | grep "^I HATE YOU\$"'
|
||||
|
||||
test_expect_success 'pserver authentication (login)' \
|
||||
'cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU$"'
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
||||
|
||||
test_expect_success 'pserver authentication failure (login/non-anonymous user)' \
|
||||
'if cat login-git | git-cvsserver pserver >log 2>&1
|
||||
@ -118,7 +118,7 @@ test_expect_success 'pserver authentication failure (login/non-anonymous user)'
|
||||
else
|
||||
true
|
||||
fi &&
|
||||
sed -ne \$p log | grep "^I HATE YOU$"'
|
||||
sed -ne \$p log | grep "^I HATE YOU\$"'
|
||||
|
||||
|
||||
# misuse pserver authentication for testing of req_Root
|
||||
@ -156,7 +156,7 @@ test_expect_success 'req_Root failure (conflicting roots)' \
|
||||
|
||||
test_expect_success 'req_Root (strict paths)' \
|
||||
'cat request-anonymous | git-cvsserver --strict-paths pserver "$SERVERDIR" >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU$"'
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
||||
|
||||
test_expect_success 'req_Root failure (strict-paths)' '
|
||||
! cat request-anonymous |
|
||||
@ -165,7 +165,7 @@ test_expect_success 'req_Root failure (strict-paths)' '
|
||||
|
||||
test_expect_success 'req_Root (w/o strict-paths)' \
|
||||
'cat request-anonymous | git-cvsserver pserver "$WORKDIR/" >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU$"'
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
||||
|
||||
test_expect_success 'req_Root failure (w/o strict-paths)' '
|
||||
! cat request-anonymous |
|
||||
@ -183,7 +183,7 @@ EOF
|
||||
|
||||
test_expect_success 'req_Root (base-path)' \
|
||||
'cat request-base | git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU$"'
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
||||
|
||||
test_expect_success 'req_Root failure (base-path)' '
|
||||
! cat request-anonymous |
|
||||
@ -194,14 +194,14 @@ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
|
||||
|
||||
test_expect_success 'req_Root (export-all)' \
|
||||
'cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU$"'
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
||||
|
||||
test_expect_success 'req_Root failure (export-all w/o whitelist)' \
|
||||
'! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
|
||||
|
||||
test_expect_success 'req_Root (everything together)' \
|
||||
'cat request-base | git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
|
||||
sed -ne \$p log | grep "^I LOVE YOU$"'
|
||||
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
||||
|
||||
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user