Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

0 notes on commit 9524cf2

Please sign in to comment.
Something went wrong with that request. Please try again.