Git fork

tests: use test_write_lines() to generate line-oriented output

Take advantage of test_write_lines() to generate line-oriented output
rather than using for-loops or a series of `echo` commands. Not only is
test_write_lines() a natural fit for such a task, but there is less
opportunity for a broken &&-chain.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Eric Sunshine and committed by
Junio C Hamano
08495412 020b813f

+106 -170
+14 -14
t/t0020-crlf.sh
··· 22 22 23 23 git config core.autocrlf false && 24 24 25 - for w in Hello world how are you; do echo $w; done >one && 25 + test_write_lines Hello world how are you >one && 26 26 mkdir dir && 27 - for w in I am very very fine thank you; do echo $w; done >dir/two && 28 - for w in Oh here is NULQin text here; do echo $w; done | q_to_nul >three && 27 + test_write_lines I am very very fine thank you >dir/two && 28 + test_write_lines Oh here is NULQin text here | q_to_nul >three && 29 29 git add . && 30 30 31 31 git commit -m initial && ··· 35 35 two=$(git rev-parse HEAD:dir/two) && 36 36 three=$(git rev-parse HEAD:three) && 37 37 38 - for w in Some extra lines here; do echo $w; done >>one && 38 + test_write_lines Some extra lines here >>one && 39 39 git diff >patch.file && 40 40 patched=$(git hash-object --stdin <one) && 41 41 git read-tree --reset -u HEAD ··· 46 46 git config core.autocrlf input && 47 47 git config core.safecrlf true && 48 48 49 - for w in I am all CRLF; do echo $w; done | append_cr >allcrlf && 49 + test_write_lines I am all CRLF | append_cr >allcrlf && 50 50 test_must_fail git add allcrlf 51 51 ' 52 52 ··· 55 55 git config core.autocrlf input && 56 56 git config core.safecrlf true && 57 57 58 - for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed && 58 + test_write_lines Oh here is CRLFQ in text | q_to_cr >mixed && 59 59 test_must_fail git add mixed 60 60 ' 61 61 ··· 64 64 git config core.autocrlf true && 65 65 git config core.safecrlf true && 66 66 67 - for w in I am all LF; do echo $w; done >alllf && 67 + test_write_lines I am all LF >alllf && 68 68 test_must_fail git add alllf 69 69 ' 70 70 ··· 73 73 git config core.autocrlf true && 74 74 git config core.safecrlf true && 75 75 76 - for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed && 76 + test_write_lines Oh here is CRLFQ in text | q_to_cr >mixed && 77 77 test_must_fail git add mixed 78 78 ' 79 79 ··· 82 82 git config core.autocrlf input && 83 83 git config core.safecrlf warn && 84 84 85 - for w in I am all LF; do echo $w; done >doublewarn && 85 + test_write_lines I am all LF >doublewarn && 86 86 git add doublewarn && 87 87 git commit -m "nowarn" && 88 - for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >doublewarn && 88 + test_write_lines Oh here is CRLFQ in text | q_to_cr >doublewarn && 89 89 git add doublewarn 2>err && 90 90 grep "CRLF will be replaced by LF" err >err.warnings && 91 91 test_line_count = 1 err.warnings ··· 103 103 git config core.autocrlf input && 104 104 git config core.safecrlf false && 105 105 106 - for w in I am all CRLF; do echo $w; done | append_cr >allcrlf && 106 + test_write_lines I am all CRLF | append_cr >allcrlf && 107 107 git add allcrlf 2>err && 108 108 test_must_be_empty err 109 109 ' ··· 351 351 git config core.autocrlf false && 352 352 git config core.safecrlf false && 353 353 rm -rf .????* * && 354 - for w in I am all LF; do echo $w; done >alllf && 355 - for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed && 356 - for w in I am all CRLF; do echo $w; done | append_cr >allcrlf && 354 + test_write_lines I am all LF >alllf && 355 + test_write_lines Oh here is CRLFQ in text | q_to_cr >mixed && 356 + test_write_lines I am all CRLF | append_cr >allcrlf && 357 357 git add -A . && 358 358 git commit -m "alllf, allcrlf and mixed only" && 359 359 git tag -a -m "message" autocrlf-checkpoint
+2 -2
t/t0026-eol-config.sh
··· 15 15 16 16 echo "one text" > .gitattributes && 17 17 18 - for w in Hello world how are you; do echo $w; done >one && 19 - for w in I am very very fine thank you; do echo $w; done >two && 18 + test_write_lines Hello world how are you >one && 19 + test_write_lines I am very very fine thank you >two && 20 20 git add . && 21 21 22 22 git commit -m initial &&
+2 -2
t/t1020-subdirectory.sh
··· 11 11 12 12 test_expect_success setup ' 13 13 long="a b c d e f g h i j k l m n o p q r s t u v w x y z" && 14 - for c in $long; do echo $c; done >one && 14 + test_write_lines $long >one && 15 15 mkdir dir && 16 - for c in x y z $long a b c; do echo $c; done >dir/two && 16 + test_write_lines x y z $long a b c >dir/two && 17 17 cp one original.one && 18 18 cp dir/two original.two 19 19 '
+2 -8
t/t1512-rev-parse-disambiguation.sh
··· 34 34 test_expect_success 'blob and tree' ' 35 35 test_tick && 36 36 ( 37 - for i in 0 1 2 3 4 5 6 7 8 9 38 - do 39 - echo $i 40 - done && 37 + test_write_lines 0 1 2 3 4 5 6 7 8 9 && 41 38 echo && 42 39 echo b1rwzyc3 43 40 ) >a0blgqsjc && ··· 204 201 git checkout v1.0.0^0 && 205 202 git mv a0blgqsjc f5518nwu && 206 203 207 - for i in h62xsjeu j08bekfvt kg7xflhm 208 - do 209 - echo $i 210 - done >>f5518nwu && 204 + test_write_lines h62xsjeu j08bekfvt kg7xflhm >>f5518nwu && 211 205 git add f5518nwu && 212 206 213 207 test_tick &&
+1 -1
t/t2103-update-index-ignore-missing.sh
··· 23 23 test_cmp expect actual && 24 24 25 25 git update-index --add one two three && 26 - for i in one three two; do echo $i; done >expect && 26 + test_write_lines one three two >expect && 27 27 git ls-files >actual && 28 28 test_cmp expect actual && 29 29
+1 -3
t/t3417-rebase-whitespace-fix.sh
··· 115 115 git config core.whitespace "blank-at-eol" && 116 116 cp beginning file && 117 117 git commit -m beginning file && 118 - for i in 1 2 3 4 5; do 119 - echo $i 120 - done >> file && 118 + test_write_lines 1 2 3 4 5 >>file && 121 119 git commit -m more file && 122 120 git rebase --whitespace=fix HEAD^^ && 123 121 test_cmp expect-beginning file
+11 -11
t/t4013-diff-various.sh
··· 19 19 20 20 mkdir dir && 21 21 mkdir dir2 && 22 - for i in 1 2 3; do echo $i; done >file0 && 23 - for i in A B; do echo $i; done >dir/sub && 22 + test_write_lines 1 2 3 >file0 && 23 + test_write_lines A B >dir/sub && 24 24 cat file0 >file2 && 25 25 git add file0 file2 dir/sub && 26 26 git commit -m Initial && ··· 32 32 GIT_COMMITTER_DATE="2006-06-26 00:01:00 +0000" && 33 33 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && 34 34 35 - for i in 4 5 6; do echo $i; done >>file0 && 36 - for i in C D; do echo $i; done >>dir/sub && 35 + test_write_lines 4 5 6 >>file0 && 36 + test_write_lines C D >>dir/sub && 37 37 rm -f file2 && 38 38 git update-index --remove file0 file2 dir/sub && 39 39 git commit -m "Second${LF}${LF}This is the second commit." && ··· 42 42 GIT_COMMITTER_DATE="2006-06-26 00:02:00 +0000" && 43 43 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && 44 44 45 - for i in A B C; do echo $i; done >file1 && 45 + test_write_lines A B C >file1 && 46 46 git add file1 && 47 - for i in E F; do echo $i; done >>dir/sub && 47 + test_write_lines E F >>dir/sub && 48 48 git update-index dir/sub && 49 49 git commit -m Third && 50 50 ··· 53 53 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && 54 54 55 55 git checkout side && 56 - for i in A B C; do echo $i; done >>file0 && 57 - for i in 1 2; do echo $i; done >>dir/sub && 56 + test_write_lines A B C >>file0 && 57 + test_write_lines 1 2 >>dir/sub && 58 58 cat dir/sub >file3 && 59 59 git add file3 && 60 60 git update-index file0 dir/sub && ··· 71 71 GIT_COMMITTER_DATE="2006-06-26 00:05:00 +0000" && 72 72 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && 73 73 74 - for i in A B C; do echo $i; done >>file0 && 75 - for i in 1 2; do echo $i; done >>dir/sub && 74 + test_write_lines A B C >>file0 && 75 + test_write_lines 1 2 >>dir/sub && 76 76 git update-index file0 dir/sub && 77 77 78 78 mkdir dir3 && ··· 86 86 GIT_COMMITTER_DATE="2006-06-26 00:06:00 +0000" && 87 87 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && 88 88 git checkout -b rearrange initial && 89 - for i in B A; do echo $i; done >dir/sub && 89 + test_write_lines B A >dir/sub && 90 90 git add dir/sub && 91 91 git commit -m "Rearranged lines in dir/sub" && 92 92 git checkout master &&
+13 -13
t/t4014-format-patch.sh
··· 12 12 . "$TEST_DIRECTORY"/lib-terminal.sh 13 13 14 14 test_expect_success setup ' 15 - for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file && 15 + test_write_lines 1 2 3 4 5 6 7 8 9 10 >file && 16 16 cat file >elif && 17 17 git add file elif && 18 18 test_tick && 19 19 git commit -m Initial && 20 20 git checkout -b side && 21 21 22 - for i in 1 2 5 6 A B C 7 8 9 10; do echo "$i"; done >file && 22 + test_write_lines 1 2 5 6 A B C 7 8 9 10 >file && 23 23 test_chmod +x elif && 24 24 test_tick && 25 25 git commit -m "Side changes #1" && 26 26 27 - for i in D E F; do echo "$i"; done >>file && 27 + test_write_lines D E F >>file && 28 28 git update-index file && 29 29 test_tick && 30 30 git commit -m "Side changes #2" && 31 31 git tag C2 && 32 32 33 - for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file && 33 + test_write_lines 5 6 1 2 3 A 4 B C 7 8 9 10 D E F >file && 34 34 git update-index file && 35 35 test_tick && 36 36 git commit -m "Side changes #3 with \\n backslash-n in it." && ··· 43 43 44 44 git checkout side && 45 45 git checkout -b patchid && 46 - for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file2 && 47 - for i in 1 2 3 A 4 B C 7 8 9 10 D E F 5 6; do echo "$i"; done >file3 && 48 - for i in 8 9 10; do echo "$i"; done >file && 46 + test_write_lines 5 6 1 2 3 A 4 B C 7 8 9 10 D E F >file2 && 47 + test_write_lines 1 2 3 A 4 B C 7 8 9 10 D E F 5 6 >file3 && 48 + test_write_lines 8 9 10 >file && 49 49 git add file file2 file3 && 50 50 test_tick && 51 51 git commit -m "patchid 1" && 52 - for i in 4 A B 7 8 9 10; do echo "$i"; done >file2 && 53 - for i in 8 9 10 5 6; do echo "$i"; done >file3 && 52 + test_write_lines 4 A B 7 8 9 10 >file2 && 53 + test_write_lines 8 9 10 5 6 >file3 && 54 54 git add file2 file3 && 55 55 test_tick && 56 56 git commit -m "patchid 2" && 57 - for i in 10 5 6; do echo "$i"; done >file && 57 + test_write_lines 10 5 6 >file && 58 58 git add file && 59 59 test_tick && 60 60 git commit -m "patchid 3" && ··· 653 653 git checkout side && 654 654 before=$(git hash-object file) && 655 655 before=$(git rev-parse --short $before) && 656 - for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >>file && 656 + test_write_lines 5 6 1 2 3 A 4 B C 7 8 9 10 D E F >>file && 657 657 after=$(git hash-object file) && 658 658 after=$(git rev-parse --short $after) && 659 659 git update-index file && ··· 1086 1086 test_expect_success 'format-patch handles multi-line subjects' ' 1087 1087 rm -rf patches/ && 1088 1088 echo content >>file && 1089 - for i in one two three; do echo $i; done >msg && 1089 + test_write_lines one two three >msg && 1090 1090 git add file && 1091 1091 git commit -F msg && 1092 1092 git format-patch -o patches -1 && ··· 1098 1098 test_expect_success 'format-patch handles multi-line encoded subjects' ' 1099 1099 rm -rf patches/ && 1100 1100 echo content >>file && 1101 - for i in en två tre; do echo $i; done >msg && 1101 + test_write_lines en två tre >msg && 1102 1102 git add file && 1103 1103 git commit -F msg && 1104 1104 git format-patch -o patches -1 &&
+2 -2
t/t4019-diff-wserror.sh
··· 287 287 ' 288 288 289 289 test_expect_success 'color new trailing blank lines' ' 290 - { echo a; echo b; echo; echo; } >x && 290 + test_write_lines a b "" "" >x && 291 291 git add x && 292 - { echo a; echo; echo; echo; echo c; echo; echo; echo; echo; } >x && 292 + test_write_lines a "" "" "" c "" "" "" "" >x && 293 293 git diff --color x >output && 294 294 cnt=$($grep_a "${blue_grep}" output | wc -l) && 295 295 test $cnt = 2
+2 -8
t/t4105-apply-fuzz.sh
··· 15 15 16 16 test_expect_success setup ' 17 17 18 - for i in 1 2 3 4 5 6 7 8 9 10 11 12 19 - do 20 - echo $i 21 - done >file && 18 + test_write_lines 1 2 3 4 5 6 7 8 9 10 11 12 >file && 22 19 git update-index --add file && 23 - for i in 1 2 3 4 5 6 7 a b c d e 8 9 10 11 12 24 - do 25 - echo $i 26 - done >file && 20 + test_write_lines 1 2 3 4 5 6 7 a b c d e 8 9 10 11 12 >file && 27 21 cat file >expect && 28 22 git diff >O0.diff && 29 23
+2 -2
t/t4116-apply-reverse.sh
··· 11 11 12 12 test_expect_success setup ' 13 13 14 - for i in a b c d e f g h i j k l m n; do echo $i; done >file1 && 14 + test_write_lines a b c d e f g h i j k l m n >file1 && 15 15 perl -pe "y/ijk/\\000\\001\\002/" <file1 >file2 && 16 16 17 17 git add file1 file2 && 18 18 git commit -m initial && 19 19 git tag initial && 20 20 21 - for i in a b c g h i J K L m o n p q; do echo $i; done >file1 && 21 + test_write_lines a b c g h i J K L m o n p q >file1 && 22 22 perl -pe "y/mon/\\000\\001\\002/" <file1 >file2 && 23 23 24 24 git commit -a -m second &&
+4 -16
t/t4117-apply-reject.sh
··· 10 10 . ./test-lib.sh 11 11 12 12 test_expect_success setup ' 13 - for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 14 - do 15 - echo $i 16 - done >file1 && 13 + test_write_lines 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 >file1 && 17 14 cat file1 >saved.file1 && 18 15 git update-index --add file1 && 19 16 git commit -m initial && 20 17 21 - for i in 1 2 A B 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 D 21 22 - do 23 - echo $i 24 - done >file1 && 18 + test_write_lines 1 2 A B 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 D 21 >file1 && 25 19 git diff >patch.1 && 26 20 cat file1 >clean && 27 21 28 - for i in 1 E 2 3 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 F 21 29 - do 30 - echo $i 31 - done >expected && 22 + test_write_lines 1 E 2 3 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 F 21 >expected && 32 23 33 24 mv file1 file2 && 34 25 git update-index --add --remove file1 file2 && ··· 38 29 mv saved.file1 file1 && 39 30 git update-index --add --remove file1 file2 && 40 31 41 - for i in 1 E 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 F 21 42 - do 43 - echo $i 44 - done >file1 && 32 + test_write_lines 1 E 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 F 21 >file1 && 45 33 46 34 cat file1 >saved.file1 47 35 '
+1 -5
t/t4118-apply-empty-context.sh
··· 10 10 . ./test-lib.sh 11 11 12 12 test_expect_success setup ' 13 - { 14 - echo; echo; 15 - echo A; echo B; echo C; 16 - echo; 17 - } >file1 && 13 + test_write_lines "" "" A B C "" >file1 && 18 14 cat file1 >file1.orig && 19 15 { 20 16 cat file1 &&
+28 -28
t/t4124-apply-ws-rule.sh
··· 230 230 test_might_fail git config --unset core.whitespace && 231 231 rm -f .gitattributes && 232 232 233 - { echo a; echo b; echo c; } >one && 233 + test_write_lines a b c >one && 234 234 git add one && 235 - { echo a; echo b; echo c; } >expect && 235 + test_write_lines a b c >expect && 236 236 { cat expect; echo; } >one && 237 237 git diff -- one >patch && 238 238 ··· 242 242 ' 243 243 244 244 test_expect_success 'blank at EOF with --whitespace=fix (2)' ' 245 - { echo a; echo b; echo c; } >one && 245 + test_write_lines a b c >one && 246 246 git add one && 247 - { echo a; echo c; } >expect && 248 - { cat expect; echo; echo; } >one && 247 + test_write_lines a b >expect && 248 + { cat expect && test_write_lines "" ""; } >one && 249 249 git diff -- one >patch && 250 250 251 251 git checkout one && ··· 254 254 ' 255 255 256 256 test_expect_success 'blank at EOF with --whitespace=fix (3)' ' 257 - { echo a; echo b; echo; } >one && 257 + test_write_lines a b "" >one && 258 258 git add one && 259 - { echo a; echo c; echo; } >expect && 260 - { cat expect; echo; echo; } >one && 259 + test_write_lines a c "" >expect && 260 + { cat expect && test_write_lines "" ""; } >one && 261 261 git diff -- one >patch && 262 262 263 263 git checkout one && ··· 266 266 ' 267 267 268 268 test_expect_success 'blank at end of hunk, not at EOF with --whitespace=fix' ' 269 - { echo a; echo b; echo; echo; echo; echo; echo; echo d; } >one && 269 + test_write_lines a b "" "" "" "" "" d >one && 270 270 git add one && 271 - { echo a; echo c; echo; echo; echo; echo; echo; echo; echo d; } >expect && 271 + test_write_lines a b "" "" "" "" "" "" d >expect && 272 272 cp expect one && 273 273 git diff -- one >patch && 274 274 ··· 278 278 ' 279 279 280 280 test_expect_success 'blank at EOF with --whitespace=warn' ' 281 - { echo a; echo b; echo c; } >one && 281 + test_write_lines a b c >one && 282 282 git add one && 283 283 echo >>one && 284 284 cat one >expect && ··· 291 291 ' 292 292 293 293 test_expect_success 'blank at EOF with --whitespace=error' ' 294 - { echo a; echo b; echo c; } >one && 294 + test_write_lines a b c >one && 295 295 git add one && 296 296 cat one >expect && 297 297 echo >>one && ··· 304 304 ' 305 305 306 306 test_expect_success 'blank but not empty at EOF' ' 307 - { echo a; echo b; echo c; } >one && 307 + test_write_lines a b c >one && 308 308 git add one && 309 309 echo " " >>one && 310 310 cat one >expect && ··· 317 317 ' 318 318 319 319 test_expect_success 'applying beyond EOF requires one non-blank context line' ' 320 - { echo; echo; echo; echo; } >one && 320 + test_write_lines "" "" "" "" >one && 321 321 git add one && 322 - { echo b; } >>one && 322 + echo b >>one && 323 323 git diff -- one >patch && 324 324 325 325 git checkout one && 326 - { echo a; echo; } >one && 326 + test_write_lines a "" >one && 327 327 cp one expect && 328 328 test_must_fail git apply --whitespace=fix patch && 329 329 test_cmp expect one && ··· 333 333 334 334 test_expect_success 'tons of blanks at EOF should not apply' ' 335 335 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do 336 - echo; echo; echo; echo; 336 + test_write_lines "" "" "" "" 337 337 done >one && 338 338 git add one && 339 339 echo a >>one && ··· 362 362 ' 363 363 364 364 test_expect_success 'two missing blank lines at end with --whitespace=fix' ' 365 - { echo a; echo; echo b; echo c; } >one && 365 + test_write_lines a "" b c >one && 366 366 cp one no-blank-lines && 367 - { echo; echo; } >>one && 367 + test_write_lines "" "" >>one && 368 368 git add one && 369 369 echo d >>one && 370 370 cp one expect && ··· 381 381 ' 382 382 383 383 test_expect_success 'missing blank line at end, insert before end, --whitespace=fix' ' 384 - { echo a; echo; } >one && 384 + test_write_lines a "" >one && 385 385 git add one && 386 - { echo b; echo a; echo; } >one && 386 + test_write_lines b a "" >one && 387 387 cp one expect && 388 388 git diff -- one >patch && 389 389 echo a >one && ··· 393 393 ' 394 394 395 395 test_expect_success 'shrink file with tons of missing blanks at end of file' ' 396 - { echo a; echo b; echo c; } >one && 396 + test_write_lines a b c >one && 397 397 cp one no-blank-lines && 398 398 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do 399 - echo; echo; echo; echo; 399 + test_write_lines "" "" "" "" 400 400 done >>one && 401 401 git add one && 402 402 echo a >one && ··· 412 412 ' 413 413 414 414 test_expect_success 'missing blanks at EOF must only match blank lines' ' 415 - { echo a; echo b; } >one && 415 + test_write_lines a b >one && 416 416 git add one && 417 - { echo c; echo d; } >>one && 417 + test_write_lines c d >>one && 418 418 git diff -- one >patch && 419 419 420 420 echo a >one && ··· 434 434 git add one && 435 435 echo d >>one && 436 436 git diff -- one >patch && 437 - { echo a; echo b; echo c; } >one && 437 + test_write_lines a b c >one && 438 438 cp one expect && 439 - { echo; echo d; } >>expect && 439 + test_write_lines "" d >>expect && 440 440 git add one && 441 441 442 442 git apply --whitespace=fix patch && ··· 455 455 echo d >>one && 456 456 cp one expect && 457 457 git diff -- one >patch && 458 - { echo a; echo b; echo c; } >one && 458 + test_write_lines a b c >one && 459 459 git add one && 460 460 461 461 git checkout-index -f one &&
+1 -4
t/t4126-apply-empty.sh
··· 9 9 git add empty && 10 10 test_tick && 11 11 git commit -m initial && 12 - for i in a b c d e 13 - do 14 - echo $i 15 - done >empty && 12 + test_write_lines a b c d e >empty && 16 13 cat empty >expect && 17 14 git diff | 18 15 sed -e "/^diff --git/d" \
+1 -4
t/t4127-apply-same-fn.sh
··· 10 10 } 11 11 12 12 test_expect_success setup ' 13 - for i in a b c d e f g h i j k l m 14 - do 15 - echo $i 16 - done >same_fn && 13 + test_write_lines a b c d e f g h i j k l m >same_fn && 17 14 cp same_fn other_fn && 18 15 git add same_fn other_fn && 19 16 git commit -m initial
+2 -8
t/t4151-am-abort.sh
··· 5 5 . ./test-lib.sh 6 6 7 7 test_expect_success setup ' 8 - for i in a b c d e f g 9 - do 10 - echo $i 11 - done >file-1 && 8 + test_write_lines a b c d e f g >file-1 && 12 9 cp file-1 file-2 && 13 10 test_tick && 14 11 git add file-1 file-2 && ··· 43 40 44 41 test_must_fail git am$with3 000[1245]-*.patch && 45 42 git log --pretty=tformat:%s >actual && 46 - for i in 3 2 initial 47 - do 48 - echo $i 49 - done >expect && 43 + test_write_lines 3 2 initial >expect && 50 44 test_cmp expect actual 51 45 ' 52 46
+2 -10
t/t5300-pack-object.sh
··· 361 361 ST=$(git write-tree) && 362 362 git rev-list --objects "$LIST" "$LI" "$ST" >actual && 363 363 PACK5=$( git pack-objects test-5 <actual ) && 364 - PACK6=$( ( 365 - echo "$LIST" 366 - echo "$LI" 367 - echo "$ST" 368 - ) | git pack-objects test-6 ) && 364 + PACK6=$( test_write_lines "$LIST" "$LI" "$ST" | git pack-objects test-6 ) && 369 365 test_create_repo test-5 && 370 366 ( 371 367 cd test-5 && ··· 408 404 ST=$(git write-tree) && 409 405 git rev-list --objects "$LIST" "$LI" "$ST" >actual && 410 406 PACK5=$( git pack-objects test-5 <actual ) && 411 - PACK6=$( ( 412 - echo "$LIST" 413 - echo "$LI" 414 - echo "$ST" 415 - ) | git pack-objects test-6 ) && 407 + PACK6=$( test_write_lines "$LIST" "$LI" "$ST" | git pack-objects test-6 ) && 416 408 test_create_repo test-7 && 417 409 ( 418 410 cd test-7 &&
+1 -1
t/t5306-pack-nobase.sh
··· 12 12 # 13 13 test_expect_success \ 14 14 'setup base' \ 15 - 'for a in a b c d e f g h i; do echo $a >>text; done && 15 + 'test_write_lines a b c d e f g h i >text && 16 16 echo side >side && 17 17 git update-index --add text side && 18 18 A=$(echo A | git commit-tree $(git write-tree)) &&
+1 -1
t/t5611-clone-config.sh
··· 17 17 test_expect_success 'clone -c can set multi-keys' ' 18 18 rm -rf child && 19 19 git clone -c core.foo=bar -c core.foo=baz . child && 20 - { echo bar; echo baz; } >expect && 20 + test_write_lines bar baz >expect && 21 21 git --git-dir=child/.git config --get-all core.foo >actual && 22 22 test_cmp expect actual 23 23 '
+5 -5
t/t6019-rev-list-ancestry-path.sh
··· 51 51 ' 52 52 53 53 test_expect_success 'rev-list D..M' ' 54 - for c in E F G H I J K L M; do echo $c; done >expect && 54 + test_write_lines E F G H I J K L M >expect && 55 55 git rev-list --format=%s D..M | 56 56 sed -e "/^commit /d" | 57 57 sort >actual && ··· 59 59 ' 60 60 61 61 test_expect_success 'rev-list --ancestry-path D..M' ' 62 - for c in E F H I J L M; do echo $c; done >expect && 62 + test_write_lines E F H I J L M >expect && 63 63 git rev-list --ancestry-path --format=%s D..M | 64 64 sed -e "/^commit /d" | 65 65 sort >actual && ··· 81 81 ' 82 82 83 83 test_expect_success 'rev-list F...I' ' 84 - for c in F G H I; do echo $c; done >expect && 84 + test_write_lines F G H I >expect && 85 85 git rev-list --format=%s F...I | 86 86 sed -e "/^commit /d" | 87 87 sort >actual && ··· 89 89 ' 90 90 91 91 test_expect_success 'rev-list --ancestry-path F...I' ' 92 - for c in F H I; do echo $c; done >expect && 92 + test_write_lines F H I >expect && 93 93 git rev-list --ancestry-path --format=%s F...I | 94 94 sed -e "/^commit /d" | 95 95 sort >actual && ··· 111 111 ' 112 112 113 113 test_expect_success 'rev-list --ancestry-path --simplify-merges G^..M -- G.t' ' 114 - for c in G L; do echo $c; done >expect && 114 + test_write_lines G L >expect && 115 115 git rev-list --ancestry-path --simplify-merges --format=%s G^..M -- G.t | 116 116 sed -e "/^commit /d" | 117 117 sort >actual &&
+1 -3
t/t6060-merge-index.sh
··· 4 4 . ./test-lib.sh 5 5 6 6 test_expect_success 'setup diverging branches' ' 7 - for i in 1 2 3 4 5 6 7 8 9 10; do 8 - echo $i 9 - done >file && 7 + test_write_lines 1 2 3 4 5 6 7 8 9 10 >file && 10 8 git add file && 11 9 git commit -m base && 12 10 git tag base &&
+3 -3
t/t6409-merge-subtree.sh
··· 10 10 test_expect_success setup ' 11 11 12 12 s="1 2 3 4 5 6 7 8" && 13 - for i in $s; do echo $i; done >hello && 13 + test_write_lines $s >hello && 14 14 git add hello && 15 15 git commit -m initial && 16 16 git checkout -b side && ··· 18 18 git add hello && 19 19 git commit -m second && 20 20 git checkout main && 21 - for i in mundo $s; do echo $i; done >hello && 21 + test_write_lines mundo $s >hello && 22 22 git add hello && 23 23 git commit -m main 24 24 ··· 27 27 test_expect_success 'subtree available and works like recursive' ' 28 28 29 29 git merge -s subtree side && 30 - for i in mundo $s world; do echo $i; done >expect && 30 + test_write_lines mundo $s world >expect && 31 31 test_cmp expect hello 32 32 33 33 '
+1 -4
t/t6417-merge-ours-theirs.sh
··· 7 7 . ./test-lib.sh 8 8 9 9 test_expect_success setup ' 10 - for i in 1 2 3 4 5 6 7 8 9 11 - do 12 - echo "$i" 13 - done >file && 10 + test_write_lines 1 2 3 4 5 6 7 8 9 >file && 14 11 git add file && 15 12 cp file elif && 16 13 git commit -m initial &&
+1 -4
t/t7501-commit-basic-functionality.sh
··· 667 667 668 668 test_expect_success 'commit a file whose name is a dash' ' 669 669 git reset --hard && 670 - for i in 1 2 3 4 5 671 - do 672 - echo $i 673 - done >./- && 670 + test_write_lines 1 2 3 4 5 >./- && 674 671 git add ./- && 675 672 test_tick && 676 673 git commit -m "add dash" >output </dev/null &&
+2 -8
t/t8003-blame-corner-cases.sh
··· 13 13 echo B B B B B >two && 14 14 echo C C C C C >tres && 15 15 echo ABC >mouse && 16 - for i in 1 2 3 4 5 6 7 8 9 17 - do 18 - echo $i 19 - done >nine_lines && 20 - for i in 1 2 3 4 5 6 7 8 9 a 21 - do 22 - echo $i 23 - done >ten_lines && 16 + test_write_lines 1 2 3 4 5 6 7 8 9 >nine_lines && 17 + test_write_lines 1 2 3 4 5 6 7 8 9 a >ten_lines && 24 18 git add one two tres mouse nine_lines ten_lines && 25 19 test_tick && 26 20 GIT_AUTHOR_NAME=Initial git commit -m Initial &&