@matheusbsbs / matheus-bagliano / commits / 9524cf2993
Fork 0

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>

Stephen Boyd committed Jan 26, 2010 at 15:08 UTC 9524cf29930b4f91d68ad1384d7f984393a54c15
12 files changed +52 -52
git-filter-branch.sh
+2 -2
@@ -462,11 +462,11 @@ if [ "$filter_tag_name" ]; then
462 "$new_sha1" "$new_ref"
463 git cat-file tag "$ref" |
464 sed -n \
465 - -e "1,/^$/{
465 + -e '1,/^$/{
466 /^object /d
467 /^type /d
468 /^tag /d
469 - }" \
469 + }' \
470 -e '/^-----BEGIN PGP SIGNATURE-----/q' \
471 -e 'p' ) |
472 git mktag) ||
git-instaweb.sh
+1 -1
@@ -320,7 +320,7 @@ EOF
320 else
321 # plain-old CGI
322 resolve_full_httpd
323 - list_mods=$(echo "$full_httpd" | sed "s/-f$/-l/")
323 + list_mods=$(echo "$full_httpd" | sed 's/-f$/-l/')
324 $list_mods | sane_grep 'mod_cgi\.c' >/dev/null 2>&1 || \
325 if test -f "$module_path/mod_cgi.so"
326 then
git-rebase--interactive.sh
+1 -1
@@ -407,7 +407,7 @@ update_squash_messages () {
407 }
408
409 peek_next_command () {
410 - sed -n -e "/^#/d" -e "/^$/d" -e "s/ .*//p" -e "q" < "$TODO"
410 + sed -n -e "/^#/d" -e '/^$/d' -e "s/ .*//p" -e "q" < "$TODO"
411 }
412
413 # A squash/fixup has failed. Prepare the long version of the squash
t/t3408-rebase-multi-line.sh
+2 -2
@@ -32,8 +32,8 @@ test_expect_success rebase '
32
33 git checkout side &&
34 git rebase master &&
35 - git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
36 - git cat-file commit side@{1} | sed -e "1,/^$/d" >expect &&
35 + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
36 + git cat-file commit side@{1} | sed -e "1,/^\$/d" >expect &&
37 test_cmp expect actual
38
39 '
t/t4014-format-patch.sh
+22 -22
@@ -93,9 +93,9 @@ test_expect_success 'extra headers' '
93 git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>
94 " &&
95 git format-patch --stdout master..side > patch2 &&
96 - sed -e "/^$/q" patch2 > hdrs2 &&
97 - grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs2 &&
98 - grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs2
96 + sed -e "/^\$/q" patch2 > hdrs2 &&
97 + grep "^To: R. E. Cipient <rcipient@example.com>\$" hdrs2 &&
98 + grep "^Cc: S. E. Cipient <scipient@example.com>\$" hdrs2
99
100 '
101
@@ -104,9 +104,9 @@ test_expect_success 'extra headers without newlines' '
104 git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
105 git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>" &&
106 git format-patch --stdout master..side >patch3 &&
107 - sed -e "/^$/q" patch3 > hdrs3 &&
108 - grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs3 &&
109 - grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs3
107 + sed -e "/^\$/q" patch3 > hdrs3 &&
108 + grep "^To: R. E. Cipient <rcipient@example.com>\$" hdrs3 &&
109 + grep "^Cc: S. E. Cipient <scipient@example.com>\$" hdrs3
110
111 '
112
@@ -115,32 +115,32 @@ test_expect_success 'extra headers with multiple To:s' '
115 git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
116 git config --add format.headers "To: S. E. Cipient <scipient@example.com>" &&
117 git format-patch --stdout master..side > patch4 &&
118 - sed -e "/^$/q" patch4 > hdrs4 &&
119 - grep "^To: R. E. Cipient <rcipient@example.com>,$" hdrs4 &&
120 - grep "^ *S. E. Cipient <scipient@example.com>$" hdrs4
118 + sed -e "/^\$/q" patch4 > hdrs4 &&
119 + grep "^To: R. E. Cipient <rcipient@example.com>,\$" hdrs4 &&
120 + grep "^ *S. E. Cipient <scipient@example.com>\$" hdrs4
121 '
122
123 test_expect_success 'additional command line cc' '
124
125 git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
126 - git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^$/q" >patch5 &&
127 - grep "^Cc: R. E. Cipient <rcipient@example.com>,$" patch5 &&
128 - grep "^ *S. E. Cipient <scipient@example.com>$" patch5
126 + git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch5 &&
127 + grep "^Cc: R. E. Cipient <rcipient@example.com>,\$" patch5 &&
128 + grep "^ *S. E. Cipient <scipient@example.com>\$" patch5
129 '
130
131 test_expect_success 'command line headers' '
132
133 git config --unset-all format.headers &&
134 - git format-patch --add-header="Cc: R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^$/q" >patch6 &&
135 - grep "^Cc: R. E. Cipient <rcipient@example.com>$" patch6
134 + git format-patch --add-header="Cc: R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch6 &&
135 + grep "^Cc: R. E. Cipient <rcipient@example.com>\$" patch6
136 '
137
138 test_expect_success 'configuration headers and command line headers' '
139
140 git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
141 - git format-patch --add-header="Cc: S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^$/q" >patch7 &&
142 - grep "^Cc: R. E. Cipient <rcipient@example.com>,$" patch7 &&
143 - grep "^ *S. E. Cipient <scipient@example.com>$" patch7
141 + git format-patch --add-header="Cc: S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch7 &&
142 + grep "^Cc: R. E. Cipient <rcipient@example.com>,\$" patch7 &&
143 + grep "^ *S. E. Cipient <scipient@example.com>\$" patch7
144 '
145
146 test_expect_success 'multiple files' '
@@ -406,9 +406,9 @@ test_expect_success 'cover-letter inherits diff options' '
406 git mv file foo &&
407 git commit -m foo &&
408 git format-patch --cover-letter -1 &&
409 - ! grep "file => foo .* 0 *$" 0000-cover-letter.patch &&
409 + ! grep "file => foo .* 0 *\$" 0000-cover-letter.patch &&
410 git format-patch --cover-letter -1 -M &&
411 - grep "file => foo .* 0 *$" 0000-cover-letter.patch
411 + grep "file => foo .* 0 *\$" 0000-cover-letter.patch
412
413 '
414
@@ -425,7 +425,7 @@ EOF
425 test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
426
427 git format-patch --cover-letter -2 &&
428 - sed -e "1,/A U Thor/d" -e "/^$/q" < 0000-cover-letter.patch > output &&
428 + sed -e "1,/A U Thor/d" -e "/^\$/q" < 0000-cover-letter.patch > output &&
429 test_cmp expect output
430
431 '
@@ -450,7 +450,7 @@ EOF
450 test_expect_success 'format-patch respects -U' '
451
452 git format-patch -U4 -2 &&
453 - sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
453 + sed -e "1,/^\$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
454 test_cmp expect output
455
456 '
@@ -471,7 +471,7 @@ EOF
471 test_expect_success 'format-patch -p suppresses stat' '
472
473 git format-patch -p -2 &&
474 - sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
474 + sed -e "1,/^\$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
475 test_cmp expect output
476
477 '
t/t4125-apply-ws-fuzz.sh
+2 -2
@@ -37,11 +37,11 @@ test_expect_success setup '
37 # patch-2 is the same as patch-1 but is based
38 # on a version that already has whitespace fixed,
39 # and does not introduce whitespace breakages.
40 - sed -e "s/ $//" patch-1 >patch-2 &&
40 + sed -e "s/ \$//" patch-1 >patch-2 &&
41
42 # If all whitespace breakages are fixed the contents
43 # should look like file-fixed
44 - sed -e "s/ $//" file-1 >file-fixed
44 + sed -e "s/ \$//" file-1 >file-fixed
45
46 '
47
t/t4150-am.sh
+3 -3
@@ -302,7 +302,7 @@ test_expect_success 'am --committer-date-is-author-date' '
302 git checkout first &&
303 test_tick &&
304 git am --committer-date-is-author-date patch1 &&
305 - git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
305 + git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
306 at=$(sed -ne "/^author /s/.*> //p" head1) &&
307 ct=$(sed -ne "/^committer /s/.*> //p" head1) &&
308 test "$at" = "$ct"
@@ -312,7 +312,7 @@ test_expect_success 'am without --committer-date-is-author-date' '
312 git checkout first &&
313 test_tick &&
314 git am patch1 &&
315 - git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
315 + git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
316 at=$(sed -ne "/^author /s/.*> //p" head1) &&
317 ct=$(sed -ne "/^committer /s/.*> //p" head1) &&
318 test "$at" != "$ct"
@@ -326,7 +326,7 @@ test_expect_success 'am --ignore-date' '
326 git checkout first &&
327 test_tick &&
328 git am --ignore-date patch1 &&
329 - git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
329 + git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
330 at=$(sed -ne "/^author /s/.*> //p" head1) &&
331 echo "$at" | grep "+0000"
332 '
t/t4202-log.sh
+3 -3
@@ -255,7 +255,7 @@ EOF
255
256 test_expect_success 'log --graph with merge' '
257 git log --graph --date-order --pretty=tformat:%s |
258 - sed "s/ *$//" >actual &&
258 + sed "s/ *\$//" >actual &&
259 test_cmp expect actual
260 '
261
@@ -315,7 +315,7 @@ EOF
315 test_expect_success 'log --graph with full output' '
316 git log --graph --date-order --pretty=short |
317 git name-rev --name-only --stdin |
318 - sed "s/Merge:.*/Merge: A B/;s/ *$//" >actual &&
318 + sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
319 test_cmp expect actual
320 '
321
@@ -383,7 +383,7 @@ EOF
383
384 test_expect_success 'log --graph with merge' '
385 git log --graph --date-order --pretty=tformat:%s |
386 - sed "s/ *$//" >actual &&
386 + sed "s/ *\$//" >actual &&
387 test_cmp expect actual
388 '
389
t/t6023-merge-file.sh
+2 -2
@@ -146,8 +146,8 @@ test_expect_success 'binary files cannot be merged' '
146 grep "Cannot merge binary files" merge.err
147 '
148
149 -sed -e "s/deerit.$/deerit;/" -e "s/me;$/me./" < new5.txt > new6.txt
150 -sed -e "s/deerit.$/deerit,/" -e "s/me;$/me,/" < new5.txt > new7.txt
149 +sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" < new5.txt > new6.txt
150 +sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" < new5.txt > new7.txt
151
152 test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '
153
t/t7500-commit.sh
+1 -1
@@ -150,7 +150,7 @@ EOF
150 test_expect_success '--signoff' '
151 echo "yet another content *narf*" >> foo &&
152 echo "zort" | git commit -s -F - foo &&
153 - git cat-file commit HEAD | sed "1,/^$/d" > output &&
153 + git cat-file commit HEAD | sed "1,/^\$/d" > output &&
154 test_cmp expect output
155 '
156
t/t9001-send-email.sh
+4 -4
@@ -186,8 +186,8 @@ test_expect_success 'Prompting works' '
186 --smtp-server="$(pwd)/fake.sendmail" \
187 $patches \
188 2>errors &&
189 - grep "^From: Example <from@example.com>$" msgtxt1 &&
190 - grep "^To: to@example.com$" msgtxt1
189 + grep "^From: Example <from@example.com>\$" msgtxt1 &&
190 + grep "^To: to@example.com\$" msgtxt1
191 '
192
193 test_expect_success 'cccmd works' '
@@ -236,7 +236,7 @@ test_expect_success 'Author From: in message body' '
236 --to=nobody@example.com \
237 --smtp-server="$(pwd)/fake.sendmail" \
238 $patches &&
239 - sed "1,/^$/d" < msgtxt1 > msgbody1
239 + sed "1,/^\$/d" < msgtxt1 > msgbody1
240 grep "From: A <author@example.com>" msgbody1
241 '
242
@@ -247,7 +247,7 @@ test_expect_success 'Author From: not in message body' '
247 --to=nobody@example.com \
248 --smtp-server="$(pwd)/fake.sendmail" \
249 $patches &&
250 - sed "1,/^$/d" < msgtxt1 > msgbody1
250 + sed "1,/^\$/d" < msgtxt1 > msgbody1
251 ! grep "From: A <author@example.com>" msgbody1
252 '
253
t/t9400-git-cvsserver-server.sh
+9 -9
@@ -96,7 +96,7 @@ EOF
96
97 test_expect_success 'pserver authentication' \
98 'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
99 - sed -ne \$p log | grep "^I LOVE YOU$"'
99 + sed -ne \$p log | grep "^I LOVE YOU\$"'
100
101 test_expect_success 'pserver authentication failure (non-anonymous user)' \
102 'if cat request-git | git-cvsserver pserver >log 2>&1
@@ -105,11 +105,11 @@ test_expect_success 'pserver authentication failure (non-anonymous user)' \
105 else
106 true
107 fi &&
108 - sed -ne \$p log | grep "^I HATE YOU$"'
108 + sed -ne \$p log | grep "^I HATE YOU\$"'
109
110 test_expect_success 'pserver authentication (login)' \
111 'cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
112 - sed -ne \$p log | grep "^I LOVE YOU$"'
112 + sed -ne \$p log | grep "^I LOVE YOU\$"'
113
114 test_expect_success 'pserver authentication failure (login/non-anonymous user)' \
115 'if cat login-git | git-cvsserver pserver >log 2>&1
@@ -118,7 +118,7 @@ test_expect_success 'pserver authentication failure (login/non-anonymous user)'
118 else
119 true
120 fi &&
121 - sed -ne \$p log | grep "^I HATE YOU$"'
121 + sed -ne \$p log | grep "^I HATE YOU\$"'
122
123
124 # misuse pserver authentication for testing of req_Root
@@ -156,7 +156,7 @@ test_expect_success 'req_Root failure (conflicting roots)' \
156
157 test_expect_success 'req_Root (strict paths)' \
158 'cat request-anonymous | git-cvsserver --strict-paths pserver "$SERVERDIR" >log 2>&1 &&
159 - sed -ne \$p log | grep "^I LOVE YOU$"'
159 + sed -ne \$p log | grep "^I LOVE YOU\$"'
160
161 test_expect_success 'req_Root failure (strict-paths)' '
162 ! cat request-anonymous |
@@ -165,7 +165,7 @@ test_expect_success 'req_Root failure (strict-paths)' '
165
166 test_expect_success 'req_Root (w/o strict-paths)' \
167 'cat request-anonymous | git-cvsserver pserver "$WORKDIR/" >log 2>&1 &&
168 - sed -ne \$p log | grep "^I LOVE YOU$"'
168 + sed -ne \$p log | grep "^I LOVE YOU\$"'
169
170 test_expect_success 'req_Root failure (w/o strict-paths)' '
171 ! cat request-anonymous |
@@ -183,7 +183,7 @@ EOF
183
184 test_expect_success 'req_Root (base-path)' \
185 'cat request-base | git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
186 - sed -ne \$p log | grep "^I LOVE YOU$"'
186 + sed -ne \$p log | grep "^I LOVE YOU\$"'
187
188 test_expect_success 'req_Root failure (base-path)' '
189 ! cat request-anonymous |
@@ -194,14 +194,14 @@ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
194
195 test_expect_success 'req_Root (export-all)' \
196 'cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 &&
197 - sed -ne \$p log | grep "^I LOVE YOU$"'
197 + sed -ne \$p log | grep "^I LOVE YOU\$"'
198
199 test_expect_success 'req_Root failure (export-all w/o whitelist)' \
200 '! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
201
202 test_expect_success 'req_Root (everything together)' \
203 'cat request-base | git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
204 - sed -ne \$p log | grep "^I LOVE YOU$"'
204 + sed -ne \$p log | grep "^I LOVE YOU\$"'
205
206 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1
207