Git fork

chainlint.pl: check line numbers in expected output

While working on chainlint.pl recently, we introduced some bugs that
showed incorrect line numbers in the output. But it was hard to notice,
since we sanitize the output by removing all of the line numbers! It
would be nice to retain these so we can catch any regressions.

The main reason we sanitize is for maintainability: we concatenate all
of the test snippets into a single file, so it's hard for each ".expect"
file to know at which offset its test input will be found. We can handle
that by storing the per-test line numbers in the ".expect" files, and
then dynamically offsetting them as we build the concatenated test and
expect files together.

The changes to the ".expect" files look like tedious boilerplate, but it
actually makes adding new tests easier. You can now just run:

perl chainlint.pl chainlint/foo.test |
tail -n +2 >chainlint/foo.expect

to save the output of the script minus the comment headers (after
checking that it is correct, of course). Whereas before you had to strip
the line numbers. The conversions here were done mechanically using
something like the script above, and then spot-checked manually.

It would be possible to do all of this in shell via the Makefile, but it
gets a bit complicated (and requires a lot of extra processes). Instead,
I've written a short perl script that generates the concatenated files
(we already depend on perl, since chainlint.pl uses it). Incidentally,
this improves a few other things:

- we incorrectly used $(CHAINLINTTMP_SQ) inside a double-quoted
string. So if your test directory required quoting, like:

make "TEST_OUTPUT_DIRECTORY=/tmp/h'orrible"

we'd fail the chainlint tests.

- the shell in the Makefile didn't handle &&-chaining correctly in its
loops (though in practice the "sed" and "cat" invocations are not
likely to fail).

- likewise, the sed invocation to strip numbers was hiding the exit
code of chainlint.pl itself. In practice this isn't a big deal;
since there are linter violations in the test files, we expect it to
exit non-zero. But we could later use exit codes to distinguish
serious errors from expected ones.

- we now use a constant number of processes, instead of scaling with
the number of test scripts. So it should be a little faster (on my
machine, "make check-chainlint" goes from 133ms to 73ms).

There are some alternatives to this approach, but I think this is still
a good intermediate step:

1. We could invoke chainlint.pl individually on each test file, and
compare it to the expected output (and possibly using "make" to
avoid repeating already-done checks). This is a much bigger change
(and we'd have to figure out what to do with the "# LINT" lines in
the inputs). But in this case we'd still want the "expect" files to
be annotated with line numbers. So most of what's in this patch
would be needed anyway.

2. Likewise, we could run a single chainlint.pl and feed it all of the
scripts (with "--jobs=1" to get deterministic output). But we'd
still need to annotate the scripts as we did here, and we'd still
need to either assemble the "expect" file, or break apart the
script output to compare to each individual ".expect" file.

So we may pursue those in the long run, but this patch gives us more
robust tests without too much extra work or moving in a useless
direction.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Jeff King and committed by
Junio C Hamano
03763e68 382f6eda

+913 -894
+2 -12
t/Makefile
··· 108 109 check-chainlint: 110 @mkdir -p '$(CHAINLINTTMP_SQ)' && \ 111 - for i in $(CHAINLINTTESTS); do \ 112 - sed -e '/^# LINT: /d' chainlint/$$i.test; \ 113 - done >'$(CHAINLINTTMP_SQ)'/tests && \ 114 - { \ 115 - echo "# chainlint: $(CHAINLINTTMP_SQ)/tests" && \ 116 - for i in $(CHAINLINTTESTS); do \ 117 - echo "# chainlint: $$i" && \ 118 - cat chainlint/$$i.expect; \ 119 - done \ 120 - } >'$(CHAINLINTTMP_SQ)'/expect && \ 121 - $(CHAINLINT) --emit-all '$(CHAINLINTTMP_SQ)'/tests | \ 122 - sed -e 's/^[1-9][0-9]* //' >'$(CHAINLINTTMP_SQ)'/actual && \ 123 diff -u '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual 124 125 test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
··· 108 109 check-chainlint: 110 @mkdir -p '$(CHAINLINTTMP_SQ)' && \ 111 + '$(PERL_PATH_SQ)' chainlint-cat.pl '$(CHAINLINTTMP_SQ)' $(CHAINLINTTESTS) && \ 112 + { $(CHAINLINT) --emit-all '$(CHAINLINTTMP_SQ)'/tests >'$(CHAINLINTTMP_SQ)'/actual || true; } && \ 113 diff -u '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual 114 115 test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
+29
t/chainlint-cat.pl
···
··· 1 + #!/usr/bin/env perl 2 + 3 + my $outdir = shift; 4 + open(my $tests, '>', "$outdir/tests") 5 + or die "unable to open $outdir/tests: $!"; 6 + open(my $expect, '>', "$outdir/expect") 7 + or die "unable to open $outdir/expect: $!"; 8 + 9 + print $expect "# chainlint: $outdir/tests\n"; 10 + 11 + my $offset = 0; 12 + for my $script (@ARGV) { 13 + print $expect "# chainlint: $script\n"; 14 + 15 + open(my $expect_in, '<', "chainlint/$script.expect") 16 + or die "unable to open chainlint/$script.expect: $!"; 17 + while (<$expect_in>) { 18 + s/^\d+/$& + $offset/e; 19 + print $expect $_; 20 + } 21 + 22 + open(my $test_in, '<', "chainlint/$script.test") 23 + or die "unable to open chainlint/$script.test: $!"; 24 + while (<$test_in>) { 25 + /^# LINT: / and next; 26 + print $tests $_; 27 + $offset++; 28 + } 29 + }
+9 -9
t/chainlint/arithmetic-expansion.expect
··· 1 - ( 2 - foo && 3 - bar=$((42 + 1)) && 4 - baz 5 - ) && 6 - ( 7 - bar=$((42 + 1)) ?!AMP?! 8 - baz 9 - )
··· 1 + 2 ( 2 + 3 foo && 3 + 4 bar=$((42 + 1)) && 4 + 5 baz 5 + 6 ) && 6 + 7 ( 7 + 8 bar=$((42 + 1)) ?!AMP?! 8 + 9 baz 9 + 10 )
+10 -10
t/chainlint/bash-array.expect
··· 1 - ( 2 - foo && 3 - bar=(gumbo stumbo wumbo) && 4 - baz 5 - ) && 6 - ( 7 - foo && 8 - bar=${#bar[@]} && 9 - baz 10 - )
··· 1 + 2 ( 2 + 3 foo && 3 + 4 bar=(gumbo stumbo wumbo) && 4 + 5 baz 5 + 6 ) && 6 + 7 ( 7 + 8 foo && 8 + 9 bar=${#bar[@]} && 9 + 10 baz 10 + 11 )
+18 -18
t/chainlint/blank-line-before-esac.expect
··· 1 - test_done () { 2 - case "$test_failure" in 3 - 0) 4 - test_at_end_hook_ 5 - 6 - exit 0 ;; 7 - 8 - *) 9 - if test $test_external_has_tap -eq 0 10 - then 11 - say_color error "# failed $test_failure among $msg" 12 - say "1..$test_count" 13 - fi 14 - 15 - exit 1 ;; 16 - 17 - esac 18 - }
··· 1 + 2 test_done () { 2 + 3 case "$test_failure" in 3 + 4 0) 4 + 5 test_at_end_hook_ 5 + 6 6 + 7 exit 0 ;; 7 + 8 8 + 9 *) 9 + 10 if test $test_external_has_tap -eq 0 10 + 11 then 11 + 12 say_color error "# failed $test_failure among $msg" 12 + 13 say "1..$test_count" 13 + 14 fi 14 + 15 15 + 16 exit 1 ;; 16 + 17 17 + 18 esac 18 + 19 }
+8 -8
t/chainlint/blank-line.expect
··· 1 - ( 2 - 3 - nothing && 4 - 5 - something 6 - 7 - 8 - )
··· 1 + 2 ( 2 + 3 3 + 4 nothing && 4 + 5 5 + 6 something 6 + 7 7 + 8 8 + 9 )
+8 -8
t/chainlint/block-comment.expect
··· 1 - ( 2 - { 3 - # show a 4 - echo a && 5 - # show b 6 - echo b 7 - } 8 - )
··· 1 + 2 ( 2 + 3 { 3 + 4 # show a 4 + 5 echo a && 5 + 6 # show b 6 + 7 echo b 7 + 8 } 8 + 9 )
+23 -23
t/chainlint/block.expect
··· 1 - ( 2 - foo && 3 - { 4 - echo a ?!AMP?! 5 - echo b 6 - } && 7 - bar && 8 - { 9 - echo c 10 - } ?!AMP?! 11 - baz 12 - ) && 13 - 14 - { 15 - echo a; ?!AMP?! echo b 16 - } && 17 - { echo a; ?!AMP?! echo b; } && 18 - 19 - { 20 - echo "${var}9" && 21 - echo "done" 22 - } && 23 - finis
··· 1 + 2 ( 2 + 3 foo && 3 + 4 { 4 + 5 echo a ?!AMP?! 5 + 6 echo b 6 + 7 } && 7 + 8 bar && 8 + 9 { 9 + 10 echo c 10 + 11 } ?!AMP?! 11 + 12 baz 12 + 13 ) && 13 + 14 14 + 15 { 15 + 16 echo a; ?!AMP?! echo b 16 + 17 } && 17 + 18 { echo a; ?!AMP?! echo b; } && 18 + 19 19 + 20 { 20 + 21 echo "${var}9" && 21 + 22 echo "done" 22 + 23 } && 23 + 24 finis
+6 -6
t/chainlint/broken-chain.expect
··· 1 - ( 2 - foo && 3 - bar ?!AMP?! 4 - baz && 5 - wop 6 - )
··· 1 + 2 ( 2 + 3 foo && 3 + 4 bar ?!AMP?! 4 + 5 baz && 5 + 6 wop 6 + 7 )
+11 -11
t/chainlint/case-comment.expect
··· 1 - ( 2 - case "$x" in 3 - # found foo 4 - x) foo ;; 5 - # found other 6 - *) 7 - # treat it as bar 8 - bar 9 - ;; 10 - esac 11 - )
··· 1 + 2 ( 2 + 3 case "$x" in 3 + 4 # found foo 4 + 5 x) foo ;; 5 + 6 # found other 6 + 7 *) 7 + 8 # treat it as bar 8 + 9 bar 9 + 10 ;; 10 + 11 esac 11 + 12 )
+19 -19
t/chainlint/case.expect
··· 1 - ( 2 - case "$x" in 3 - x) foo ;; 4 - *) bar ;; 5 - esac && 6 - foobar 7 - ) && 8 - ( 9 - case "$x" in 10 - x) foo ;; 11 - *) bar ;; 12 - esac ?!AMP?! 13 - foobar 14 - ) && 15 - ( 16 - case "$x" in 1) true;; esac && 17 - case "$y" in 2) false;; esac ?!AMP?! 18 - foobar 19 - )
··· 1 + 2 ( 2 + 3 case "$x" in 3 + 4 x) foo ;; 4 + 5 *) bar ;; 5 + 6 esac && 6 + 7 foobar 7 + 8 ) && 8 + 9 ( 9 + 10 case "$x" in 10 + 11 x) foo ;; 11 + 12 *) bar ;; 12 + 13 esac ?!AMP?! 13 + 14 foobar 14 + 15 ) && 15 + 16 ( 16 + 17 case "$x" in 1) true;; esac && 17 + 18 case "$y" in 2) false;; esac ?!AMP?! 18 + 19 foobar 19 + 20 )
+9 -9
t/chainlint/chain-break-background.expect
··· 1 - JGIT_DAEMON_PID= && 2 - git init --bare empty.git && 3 - >empty.git/git-daemon-export-ok && 4 - mkfifo jgit_daemon_output && 5 - { 6 - jgit daemon --port="$JGIT_DAEMON_PORT" . >jgit_daemon_output & 7 - JGIT_DAEMON_PID=$! 8 - } && 9 - test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git
··· 1 + 2 JGIT_DAEMON_PID= && 2 + 3 git init --bare empty.git && 3 + 4 >empty.git/git-daemon-export-ok && 4 + 5 mkfifo jgit_daemon_output && 5 + 6 { 6 + 7 jgit daemon --port="$JGIT_DAEMON_PORT" . >jgit_daemon_output & 7 + 8 JGIT_DAEMON_PID=$! 8 + 9 } && 9 + 10 test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git
+12 -12
t/chainlint/chain-break-continue.expect
··· 1 - git ls-tree --name-only -r refs/notes/many_notes | 2 - while read path 3 - do 4 - test "$path" = "foobar/non-note.txt" && continue 5 - test "$path" = "deadbeef" && continue 6 - test "$path" = "de/adbeef" && continue 7 - 8 - if test $(expr length "$path") -ne $hexsz 9 - then 10 - return 1 11 - fi 12 - done
··· 1 + 2 git ls-tree --name-only -r refs/notes/many_notes | 2 + 3 while read path 3 + 4 do 4 + 5 test "$path" = "foobar/non-note.txt" && continue 5 + 6 test "$path" = "deadbeef" && continue 6 + 7 test "$path" = "de/adbeef" && continue 7 + 8 8 + 9 if test $(expr length "$path") -ne $hexsz 9 + 10 then 10 + 11 return 1 11 + 12 fi 12 + 13 done
+9 -9
t/chainlint/chain-break-false.expect
··· 1 - if condition not satisified 2 - then 3 - echo it did not work... 4 - echo failed! 5 - false 6 - else 7 - echo it went okay ?!AMP?! 8 - congratulate user 9 - fi
··· 1 + 2 if condition not satisified 2 + 3 then 3 + 4 echo it did not work... 4 + 5 echo failed! 5 + 6 false 6 + 7 else 7 + 8 echo it went okay ?!AMP?! 8 + 9 congratulate user 9 + 10 fi
+19 -19
t/chainlint/chain-break-return-exit.expect
··· 1 - case "$(git ls-files)" in 2 - one) echo pass one ;; 3 - *) echo bad one; return 1 ;; 4 - esac && 5 - ( 6 - case "$(git ls-files)" in 7 - two) echo pass two ;; 8 - *) echo bad two; exit 1 ;; 9 - esac 10 - ) && 11 - case "$(git ls-files)" in 12 - dir/two"$LF"one) echo pass both ;; 13 - *) echo bad; return 1 ;; 14 - esac && 15 - 16 - for i in 1 2 3 4 ; do 17 - git checkout main -b $i || return $? 18 - test_commit $i $i $i tag$i || return $? 19 - done
··· 1 + 2 case "$(git ls-files)" in 2 + 3 one) echo pass one ;; 3 + 4 *) echo bad one; return 1 ;; 4 + 5 esac && 5 + 6 ( 6 + 7 case "$(git ls-files)" in 7 + 8 two) echo pass two ;; 8 + 9 *) echo bad two; exit 1 ;; 9 + 10 esac 10 + 11 ) && 11 + 12 case "$(git ls-files)" in 12 + 13 dir/two"$LF"one) echo pass both ;; 13 + 14 *) echo bad; return 1 ;; 14 + 15 esac && 15 + 16 16 + 17 for i in 1 2 3 4 ; do 17 + 18 git checkout main -b $i || return $? 18 + 19 test_commit $i $i $i tag$i || return $? 19 + 20 done
+9 -9
t/chainlint/chain-break-status.expect
··· 1 - OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) && 2 - test_match_signal 13 "$OUT" && 3 - 4 - { test-tool sigchain >actual; ret=$?; } && 5 - { 6 - test_match_signal 15 "$ret" || 7 - test "$ret" = 3 8 - } && 9 - test_cmp expect actual
··· 1 + 2 OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) && 2 + 3 test_match_signal 13 "$OUT" && 3 + 4 4 + 5 { test-tool sigchain >actual; ret=$?; } && 5 + 6 { 6 + 7 test_match_signal 15 "$ret" || 7 + 8 test "$ret" = 3 8 + 9 } && 9 + 10 test_cmp expect actual
+9 -9
t/chainlint/chained-block.expect
··· 1 - echo nobody home && { 2 - test the doohicky ?!AMP?! 3 - right now 4 - } && 5 - 6 - GIT_EXTERNAL_DIFF=echo git diff | { 7 - read path oldfile oldhex oldmode newfile newhex newmode && 8 - test "z$oh" = "z$oldhex" 9 - }
··· 1 + 2 echo nobody home && { 2 + 3 test the doohicky ?!AMP?! 3 + 4 right now 4 + 5 } && 5 + 6 6 + 7 GIT_EXTERNAL_DIFF=echo git diff | { 7 + 8 read path oldfile oldhex oldmode newfile newhex newmode && 8 + 9 test "z$oh" = "z$oldhex" 9 + 10 }
+10 -10
t/chainlint/chained-subshell.expect
··· 1 - mkdir sub && ( 2 - cd sub && 3 - foo the bar ?!AMP?! 4 - nuff said 5 - ) && 6 - 7 - cut "-d " -f actual | (read s1 s2 s3 && 8 - test -f $s1 ?!AMP?! 9 - test $(cat $s2) = tree2path1 && 10 - test $(cat $s3) = tree3path1)
··· 1 + 2 mkdir sub && ( 2 + 3 cd sub && 3 + 4 foo the bar ?!AMP?! 4 + 5 nuff said 5 + 6 ) && 6 + 7 7 + 8 cut "-d " -f actual | (read s1 s2 s3 && 8 + 9 test -f $s1 ?!AMP?! 9 + 10 test $(cat $s2) = tree2path1 && 10 + 11 test $(cat $s3) = tree3path1)
+3 -3
t/chainlint/close-nested-and-parent-together.expect
··· 1 - (cd foo && 2 - (bar && 3 - baz))
··· 1 + 2 (cd foo && 2 + 3 (bar && 3 + 4 baz))
+26 -26
t/chainlint/close-subshell.expect
··· 1 - ( 2 - foo 3 - ) && 4 - ( 5 - bar 6 - ) >out && 7 - ( 8 - baz 9 - ) 2>err && 10 - ( 11 - boo 12 - ) <input && 13 - ( 14 - bip 15 - ) | wuzzle && 16 - ( 17 - bop 18 - ) | fazz \ 19 - fozz && 20 - ( 21 - bup 22 - ) | 23 - fuzzle && 24 - ( 25 - yop 26 - )
··· 1 + 2 ( 2 + 3 foo 3 + 4 ) && 4 + 5 ( 5 + 6 bar 6 + 7 ) >out && 7 + 8 ( 8 + 9 baz 9 + 10 ) 2>err && 10 + 11 ( 11 + 12 boo 12 + 13 ) <input && 13 + 14 ( 14 + 15 bip 15 + 16 ) | wuzzle && 16 + 17 ( 17 + 18 bop 18 + 19 ) | fazz \ 19 + 20 fozz && 20 + 21 ( 21 + 22 bup 22 + 23 ) | 23 + 24 fuzzle && 24 + 25 ( 25 + 26 yop 26 + 27 )
+2 -2
t/chainlint/command-substitution-subsubshell.expect
··· 1 - OUT=$( ((large_git 1>&3) | :) 3>&1 ) && 2 - test_match_signal 13 "$OUT"
··· 1 + 2 OUT=$( ((large_git 1>&3) | :) 3>&1 ) && 2 + 3 test_match_signal 13 "$OUT"
+9 -9
t/chainlint/command-substitution.expect
··· 1 - ( 2 - foo && 3 - bar=$(gobble) && 4 - baz 5 - ) && 6 - ( 7 - bar=$(gobble blocks) ?!AMP?! 8 - baz 9 - )
··· 1 + 2 ( 2 + 3 foo && 3 + 4 bar=$(gobble) && 4 + 5 baz 5 + 6 ) && 6 + 7 ( 7 + 8 bar=$(gobble blocks) ?!AMP?! 8 + 9 baz 9 + 10 )
+8 -8
t/chainlint/comment.expect
··· 1 - ( 2 - # comment 1 3 - nothing && 4 - # comment 2 5 - something 6 - # comment 3 7 - # comment 4 8 - )
··· 1 + 2 ( 2 + 3 # comment 1 3 + 4 nothing && 4 + 5 # comment 2 5 + 6 something 6 + 7 # comment 3 7 + 8 # comment 4 8 + 9 )
+9 -9
t/chainlint/complex-if-in-cuddled-loop.expect
··· 1 - (for i in a b c; do 2 - if test "$(echo $(waffle bat))" = "eleventeen" && 3 - test "$x" = "$y"; then 4 - : 5 - else 6 - echo >file 7 - fi ?!LOOP?! 8 - done) && 9 - test ! -f file
··· 1 + 2 (for i in a b c; do 2 + 3 if test "$(echo $(waffle bat))" = "eleventeen" && 3 + 4 test "$x" = "$y"; then 4 + 5 : 5 + 6 else 6 + 7 echo >file 7 + 8 fi ?!LOOP?! 8 + 9 done) && 9 + 10 test ! -f file
+6 -6
t/chainlint/cuddled-if-then-else.expect
··· 1 - (if test -z ""; then 2 - echo empty 3 - else 4 - echo bizzy 5 - fi) && 6 - echo foobar
··· 1 + 2 (if test -z ""; then 2 + 3 echo empty 3 + 4 else 4 + 5 echo bizzy 5 + 6 fi) && 6 + 7 echo foobar
+4 -4
t/chainlint/cuddled-loop.expect
··· 1 - ( while read x 2 - do foobar bop || exit 1 3 - done <file ) && 4 - outside subshell
··· 1 + 2 ( while read x 2 + 3 do foobar bop || exit 1 3 + 4 done <file ) && 4 + 5 outside subshell
+17 -17
t/chainlint/cuddled.expect
··· 1 - (cd foo && 2 - bar 3 - ) && 4 - 5 - (cd foo ?!AMP?! 6 - bar 7 - ) && 8 - 9 - ( 10 - cd foo && 11 - bar) && 12 - 13 - (cd foo && 14 - bar) && 15 - 16 - (cd foo ?!AMP?! 17 - bar)
··· 1 + 2 (cd foo && 2 + 3 bar 3 + 4 ) && 4 + 5 5 + 6 (cd foo ?!AMP?! 6 + 7 bar 7 + 8 ) && 8 + 9 9 + 10 ( 10 + 11 cd foo && 11 + 12 bar) && 12 + 13 13 + 14 (cd foo && 14 + 15 bar) && 15 + 16 16 + 17 (cd foo ?!AMP?! 17 + 18 bar)
+12 -12
t/chainlint/double-here-doc.expect
··· 1 - run_sub_test_lib_test_err run-inv-range-start \ 2 - "--run invalid range start" \ 3 - --run="a-5" <<-\EOF && 4 - test_expect_success "passing test #1" "true" 5 - test_done 6 - EOF 7 - check_sub_test_lib_test_err run-inv-range-start \ 8 - <<-\EOF_OUT 3<<-EOF_ERR 9 - > FATAL: Unexpected exit with code 1 10 - EOF_OUT 11 - > error: --run: invalid non-numeric in range start: ${SQ}a-5${SQ} 12 - EOF_ERR
··· 1 + 2 run_sub_test_lib_test_err run-inv-range-start \ 2 + 3 "--run invalid range start" \ 3 + 4 --run="a-5" <<-\EOF && 4 + 5 test_expect_success "passing test #1" "true" 5 + 6 test_done 6 + 7 EOF 7 + 8 check_sub_test_lib_test_err run-inv-range-start \ 8 + 9 <<-\EOF_OUT 3<<-EOF_ERR 9 + 10 > FATAL: Unexpected exit with code 1 10 + 11 EOF_OUT 11 + 12 > error: --run: invalid non-numeric in range start: ${SQ}a-5${SQ} 12 + 13 EOF_ERR
+5 -5
t/chainlint/dqstring-line-splice.expect
··· 1 - 2 - echo 'fatal: reword option of --fixup is mutually exclusive with' '--patch/--interactive/--all/--include/--only' >expect && 3 - test_must_fail git commit --fixup=reword:HEAD~ $1 2>actual && 4 - test_cmp expect actual 5 -
··· 1 + 2 2 + 3 echo 'fatal: reword option of --fixup is mutually exclusive with' '--patch/--interactive/--all/--include/--only' >expect && 3 + 4 test_must_fail git commit --fixup=reword:HEAD~ $1 2>actual && 4 + 5 test_cmp expect actual 5 + 6
+12 -12
t/chainlint/dqstring-no-interpolate.expect
··· 1 - grep "^ ! [rejected][ ]*$BRANCH -> $BRANCH (non-fast-forward)$" out && 2 - 3 - grep "^\.git$" output.txt && 4 - 5 - 6 - ( 7 - cd client$version && 8 - GIT_TEST_PROTOCOL_VERSION=$version git fetch-pack --no-progress .. $(cat ../input) 9 - ) >output && 10 - cut -d ' ' -f 2 <output | sort >actual && 11 - test_cmp expect actual 12 -
··· 1 + 2 grep "^ ! [rejected][ ]*$BRANCH -> $BRANCH (non-fast-forward)$" out && 2 + 3 3 + 4 grep "^\.git$" output.txt && 4 + 5 5 + 6 6 + 7 ( 7 + 8 cd client$version && 8 + 9 GIT_TEST_PROTOCOL_VERSION=$version git fetch-pack --no-progress .. $(cat ../input) 9 + 10 ) >output && 10 + 11 cut -d ' ' -f 2 <output | sort >actual && 11 + 12 test_cmp expect actual 12 + 13
+4 -4
t/chainlint/empty-here-doc.expect
··· 1 - git ls-tree $tree path >current && 2 - cat >expected <<\EOF && 3 - EOF 4 - test_output
··· 1 + 2 git ls-tree $tree path >current && 2 + 3 cat >expected <<\EOF && 3 + 4 EOF 4 + 5 test_output
+4 -4
t/chainlint/exclamation.expect
··· 1 - if ! condition; then echo nope; else yep; fi && 2 - test_prerequisite !MINGW && 3 - mail uucp!address && 4 - echo !whatever!
··· 1 + 2 if ! condition; then echo nope; else yep; fi && 2 + 3 test_prerequisite !MINGW && 3 + 4 mail uucp!address && 4 + 5 echo !whatever!
+24 -24
t/chainlint/exit-loop.expect
··· 1 - ( 2 - for i in a b c 3 - do 4 - foo || exit 1 5 - bar && 6 - baz 7 - done 8 - ) && 9 - ( 10 - while true 11 - do 12 - foo || exit 1 13 - bar && 14 - baz 15 - done 16 - ) && 17 - ( 18 - i=0 && 19 - while test $i -lt 10 20 - do 21 - echo $i || exit 22 - i=$(($i + 1)) 23 - done 24 - )
··· 1 + 2 ( 2 + 3 for i in a b c 3 + 4 do 4 + 5 foo || exit 1 5 + 6 bar && 6 + 7 baz 7 + 8 done 8 + 9 ) && 9 + 10 ( 10 + 11 while true 11 + 12 do 12 + 13 foo || exit 1 13 + 14 bar && 14 + 15 baz 15 + 16 done 16 + 17 ) && 17 + 18 ( 18 + 19 i=0 && 19 + 20 while test $i -lt 10 20 + 21 do 21 + 22 echo $i || exit 22 + 23 i=$(($i + 1)) 23 + 24 done 24 + 25 )
+5 -5
t/chainlint/exit-subshell.expect
··· 1 - ( 2 - foo || exit 1 3 - bar && 4 - baz 5 - )
··· 1 + 2 ( 2 + 3 foo || exit 1 3 + 4 bar && 4 + 5 baz 5 + 6 )
+5 -5
t/chainlint/for-loop-abbreviated.expect
··· 1 - for it 2 - do 3 - path=$(expr "$it" : ([^:]*)) && 4 - git update-index --add "$path" || exit 5 - done
··· 1 + 2 for it 2 + 3 do 3 + 4 path=$(expr "$it" : ([^:]*)) && 4 + 5 git update-index --add "$path" || exit 5 + 6 done
+14 -14
t/chainlint/for-loop.expect
··· 1 - ( 2 - for i in a b c 3 - do 4 - echo $i ?!AMP?! 5 - cat <<-\EOF ?!LOOP?! 6 - bar 7 - EOF 8 - done ?!AMP?! 9 - 10 - for i in a b c; do 11 - echo $i && 12 - cat $i ?!LOOP?! 13 - done 14 - )
··· 1 + 2 ( 2 + 3 for i in a b c 3 + 4 do 4 + 5 echo $i ?!AMP?! 5 + 6 cat <<-\EOF ?!LOOP?! 6 + 7 bar 7 + 8 EOF 8 + 9 done ?!AMP?! 9 + 10 10 + 11 for i in a b c; do 11 + 12 echo $i && 12 + 13 cat $i ?!LOOP?! 13 + 14 done 14 + 15 )
+11 -11
t/chainlint/function.expect
··· 1 - sha1_file() { 2 - echo "$*" | sed "s#..#.git/objects/&/#" 3 - } && 4 - 5 - remove_object() { 6 - file=$(sha1_file "$*") && 7 - test -e "$file" ?!AMP?! 8 - rm -f "$file" 9 - } ?!AMP?! 10 - 11 - sha1_file arg && remove_object arg
··· 1 + 2 sha1_file() { 2 + 3 echo "$*" | sed "s#..#.git/objects/&/#" 3 + 4 } && 4 + 5 5 + 6 remove_object() { 6 + 7 file=$(sha1_file "$*") && 7 + 8 test -e "$file" ?!AMP?! 8 + 9 rm -f "$file" 9 + 10 } ?!AMP?! 10 + 11 11 + 12 sha1_file arg && remove_object arg
+4 -4
t/chainlint/here-doc-close-subshell.expect
··· 1 - ( 2 - cat <<-\INPUT) 3 - fizz 4 - INPUT
··· 1 + 2 ( 2 + 3 cat <<-\INPUT) 3 + 4 fizz 4 + 5 INPUT
+11 -11
t/chainlint/here-doc-indent-operator.expect
··· 1 - cat >expect <<- EOF && 2 - header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0 3 - num_commits: $1 4 - chunks: oid_fanout oid_lookup commit_metadata generation_data bloom_indexes bloom_data 5 - EOF 6 - 7 - cat >expect << -EOF ?!AMP?! 8 - this is not indented 9 - -EOF 10 - 11 - cleanup
··· 1 + 2 cat >expect <<- EOF && 2 + 3 header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0 3 + 4 num_commits: $1 4 + 5 chunks: oid_fanout oid_lookup commit_metadata generation_data bloom_indexes bloom_data 5 + 6 EOF 6 + 7 7 + 8 cat >expect << -EOF ?!AMP?! 8 + 9 this is not indented 9 + 10 -EOF 10 + 11 11 + 12 cleanup
+8 -8
t/chainlint/here-doc-multi-line-command-subst.expect
··· 1 - ( 2 - x=$(bobble <<-\END && 3 - fossil 4 - vegetable 5 - END 6 - wiffle) ?!AMP?! 7 - echo $x 8 - )
··· 1 + 2 ( 2 + 3 x=$(bobble <<-\END && 3 + 4 fossil 4 + 5 vegetable 5 + 6 END 6 + 7 wiffle) ?!AMP?! 7 + 8 echo $x 8 + 9 )
+7 -7
t/chainlint/here-doc-multi-line-string.expect
··· 1 - ( 2 - cat <<-\TXT && echo "multi-line 3 - string" ?!AMP?! 4 - fizzle 5 - TXT 6 - bap 7 - )
··· 1 + 2 ( 2 + 3 cat <<-\TXT && echo "multi-line 3 + 4 string" ?!AMP?! 4 + 5 fizzle 5 + 6 TXT 6 + 7 bap 7 + 8 )
+25 -25
t/chainlint/here-doc.expect
··· 1 - boodle wobba \ 2 - gorgo snoot \ 3 - wafta snurb <<EOF && 4 - quoth the raven, 5 - nevermore... 6 - EOF 7 - 8 - cat <<-Arbitrary_Tag_42 >foo && 9 - snoz 10 - boz 11 - woz 12 - Arbitrary_Tag_42 13 - 14 - cat <<"zump" >boo && 15 - snoz 16 - boz 17 - woz 18 - zump 19 - 20 - horticulture <<\EOF 21 - gomez 22 - morticia 23 - wednesday 24 - pugsly 25 - EOF
··· 1 + 2 boodle wobba \ 2 + 3 gorgo snoot \ 3 + 4 wafta snurb <<EOF && 4 + 5 quoth the raven, 5 + 6 nevermore... 6 + 7 EOF 7 + 8 8 + 9 cat <<-Arbitrary_Tag_42 >foo && 9 + 10 snoz 10 + 11 boz 11 + 12 woz 12 + 13 Arbitrary_Tag_42 13 + 14 14 + 15 cat <<"zump" >boo && 15 + 16 snoz 16 + 17 boz 17 + 18 woz 18 + 19 zump 19 + 20 20 + 21 horticulture <<\EOF 21 + 22 gomez 22 + 23 morticia 23 + 24 wednesday 24 + 25 pugsly 25 + 26 EOF
+7 -7
t/chainlint/if-condition-split.expect
··· 1 - if bob && 2 - marcia || 3 - kevin 4 - then 5 - echo "nomads" ?!AMP?! 6 - echo "for sure" 7 - fi
··· 1 + 2 if bob && 2 + 3 marcia || 3 + 4 kevin 4 + 5 then 5 + 6 echo "nomads" ?!AMP?! 6 + 7 echo "for sure" 7 + 8 fi
+12 -12
t/chainlint/if-in-loop.expect
··· 1 - ( 2 - for i in a b c 3 - do 4 - if false 5 - then 6 - echo "err" 7 - exit 1 8 - fi ?!AMP?! 9 - foo 10 - done ?!AMP?! 11 - bar 12 - )
··· 1 + 2 ( 2 + 3 for i in a b c 3 + 4 do 4 + 5 if false 5 + 6 then 6 + 7 echo "err" 7 + 8 exit 1 8 + 9 fi ?!AMP?! 9 + 10 foo 10 + 11 done ?!AMP?! 11 + 12 bar 12 + 13 )
+22 -22
t/chainlint/if-then-else.expect
··· 1 - ( 2 - if test -n "" 3 - then 4 - echo very ?!AMP?! 5 - echo empty 6 - elif test -z "" 7 - then 8 - echo foo 9 - else 10 - echo foo && 11 - cat <<-\EOF 12 - bar 13 - EOF 14 - fi ?!AMP?! 15 - echo poodle 16 - ) && 17 - ( 18 - if test -n ""; then 19 - echo very && 20 - echo empty 21 - fi 22 - )
··· 1 + 2 ( 2 + 3 if test -n "" 3 + 4 then 4 + 5 echo very ?!AMP?! 5 + 6 echo empty 6 + 7 elif test -z "" 7 + 8 then 8 + 9 echo foo 9 + 10 else 10 + 11 echo foo && 11 + 12 cat <<-\EOF 12 + 13 bar 13 + 14 EOF 14 + 15 fi ?!AMP?! 15 + 16 echo poodle 16 + 17 ) && 17 + 18 ( 18 + 19 if test -n ""; then 19 + 20 echo very && 20 + 21 echo empty 21 + 22 fi 22 + 23 )
+10 -10
t/chainlint/incomplete-line.expect
··· 1 - line 1 \ 2 - line 2 \ 3 - line 3 \ 4 - line 4 && 5 - ( 6 - line 5 \ 7 - line 6 \ 8 - line 7 \ 9 - line 8 10 - )
··· 1 + 2 line 1 \ 2 + 3 line 2 \ 3 + 4 line 3 \ 4 + 5 line 4 && 5 + 6 ( 6 + 7 line 5 \ 7 + 8 line 6 \ 8 + 9 line 7 \ 9 + 10 line 8 10 + 11 )
+8 -8
t/chainlint/inline-comment.expect
··· 1 - ( 2 - foobar && # comment 1 3 - barfoo ?!AMP?! # wrong position for && 4 - flibble "not a # comment" 5 - ) && 6 - 7 - (cd foo && 8 - flibble "not a # comment")
··· 1 + 2 ( 2 + 3 foobar && # comment 1 3 + 4 barfoo ?!AMP?! # wrong position for && 4 + 5 flibble "not a # comment" 5 + 6 ) && 6 + 7 7 + 8 (cd foo && 8 + 9 flibble "not a # comment")
+15 -15
t/chainlint/loop-detect-failure.expect
··· 1 - git init r1 && 2 - for n in 1 2 3 4 5 3 - do 4 - echo "This is file: $n" > r1/file.$n && 5 - git -C r1 add file.$n && 6 - git -C r1 commit -m "$n" || return 1 7 - done && 8 - 9 - git init r2 && 10 - for n in 1000 10000 11 - do 12 - printf "%"$n"s" X > r2/large.$n && 13 - git -C r2 add large.$n && 14 - git -C r2 commit -m "$n" ?!LOOP?! 15 - done
··· 1 + 2 git init r1 && 2 + 3 for n in 1 2 3 4 5 3 + 4 do 4 + 5 echo "This is file: $n" > r1/file.$n && 5 + 6 git -C r1 add file.$n && 6 + 7 git -C r1 commit -m "$n" || return 1 7 + 8 done && 8 + 9 9 + 10 git init r2 && 10 + 11 for n in 1000 10000 11 + 12 do 12 + 13 printf "%"$n"s" X > r2/large.$n && 13 + 14 git -C r2 add large.$n && 14 + 15 git -C r2 commit -m "$n" ?!LOOP?! 15 + 16 done
+18 -18
t/chainlint/loop-detect-status.expect
··· 1 - (while test $i -le $blobcount 2 - do 3 - printf "Generating blob $i/$blobcount\r" >&2 && 4 - printf "blob\nmark :$i\ndata $blobsize\n" && 5 - #test-tool genrandom $i $blobsize && 6 - printf "%-${blobsize}s" $i && 7 - echo "M 100644 :$i $i" >> commit && 8 - i=$(($i+1)) || 9 - echo $? > exit-status 10 - done && 11 - echo "commit refs/heads/main" && 12 - echo "author A U Thor <author@email.com> 123456789 +0000" && 13 - echo "committer C O Mitter <committer@email.com> 123456789 +0000" && 14 - echo "data 5" && 15 - echo ">2gb" && 16 - cat commit) | 17 - git fast-import --big-file-threshold=2 && 18 - test ! -f exit-status
··· 1 + 2 (while test $i -le $blobcount 2 + 3 do 3 + 4 printf "Generating blob $i/$blobcount\r" >&2 && 4 + 5 printf "blob\nmark :$i\ndata $blobsize\n" && 5 + 6 #test-tool genrandom $i $blobsize && 6 + 7 printf "%-${blobsize}s" $i && 7 + 8 echo "M 100644 :$i $i" >> commit && 8 + 9 i=$(($i+1)) || 9 + 10 echo $? > exit-status 10 + 11 done && 11 + 12 echo "commit refs/heads/main" && 12 + 13 echo "author A U Thor <author@email.com> 123456789 +0000" && 13 + 14 echo "committer C O Mitter <committer@email.com> 123456789 +0000" && 14 + 15 echo "data 5" && 15 + 16 echo ">2gb" && 16 + 17 cat commit) | 17 + 18 git fast-import --big-file-threshold=2 && 18 + 19 test ! -f exit-status
+12 -12
t/chainlint/loop-in-if.expect
··· 1 - ( 2 - if true 3 - then 4 - while true 5 - do 6 - echo "pop" ?!AMP?! 7 - echo "glup" ?!LOOP?! 8 - done ?!AMP?! 9 - foo 10 - fi ?!AMP?! 11 - bar 12 - )
··· 1 + 2 ( 2 + 3 if true 3 + 4 then 4 + 5 while true 5 + 6 do 6 + 7 echo "pop" ?!AMP?! 7 + 8 echo "glup" ?!LOOP?! 8 + 9 done ?!AMP?! 9 + 10 foo 10 + 11 fi ?!AMP?! 11 + 12 bar 12 + 13 )
+10 -10
t/chainlint/loop-upstream-pipe.expect
··· 1 - ( 2 - git rev-list --objects --no-object-names base..loose | 3 - while read oid 4 - do 5 - path="$objdir/$(test_oid_to_path "$oid")" && 6 - printf "%s %d\n" "$oid" "$(test-tool chmtime --get "$path")" || 7 - echo "object list generation failed for $oid" 8 - done | 9 - sort -k1 10 - ) >expect &&
··· 1 + 2 ( 2 + 3 git rev-list --objects --no-object-names base..loose | 3 + 4 while read oid 4 + 5 do 5 + 6 path="$objdir/$(test_oid_to_path "$oid")" && 6 + 7 printf "%s %d\n" "$oid" "$(test-tool chmtime --get "$path")" || 7 + 8 echo "object list generation failed for $oid" 8 + 9 done | 9 + 10 sort -k1 10 + 11 ) >expect &&
+18 -18
t/chainlint/multi-line-nested-command-substitution.expect
··· 1 - ( 2 - foo && 3 - x=$( 4 - echo bar | 5 - cat 6 - ) && 7 - echo ok 8 - ) | 9 - sort && 10 - ( 11 - bar && 12 - x=$(echo bar | 13 - cat 14 - ) && 15 - y=$(echo baz | 16 - fip) && 17 - echo fail 18 - )
··· 1 + 2 ( 2 + 3 foo && 3 + 4 x=$( 4 + 5 echo bar | 5 + 6 cat 6 + 7 ) && 7 + 8 echo ok 8 + 9 ) | 9 + 10 sort && 10 + 11 ( 11 + 12 bar && 12 + 13 x=$(echo bar | 13 + 14 cat 14 + 15 ) && 15 + 16 y=$(echo baz | 16 + 17 fip) && 17 + 18 echo fail 18 + 19 )
+14 -14
t/chainlint/multi-line-string.expect
··· 1 - ( 2 - x="line 1 3 - line 2 4 - line 3" && 5 - y="line 1 6 - line2" ?!AMP?! 7 - foobar 8 - ) && 9 - ( 10 - echo "xyz" "abc 11 - def 12 - ghi" && 13 - barfoo 14 - )
··· 1 + 2 ( 2 + 3 x="line 1 3 + 4 line 2 4 + 5 line 3" && 5 + 6 y="line 1 6 + 7 line2" ?!AMP?! 7 + 8 foobar 8 + 9 ) && 9 + 10 ( 10 + 11 echo "xyz" "abc 11 + 12 def 12 + 13 ghi" && 13 + 14 barfoo 14 + 15 )
+5 -5
t/chainlint/negated-one-liner.expect
··· 1 - ! (foo && bar) && 2 - ! (foo && bar) >baz && 3 - 4 - ! (foo; ?!AMP?! bar) && 5 - ! (foo; ?!AMP?! bar) >baz
··· 1 + 2 ! (foo && bar) && 2 + 3 ! (foo && bar) >baz && 3 + 4 4 + 5 ! (foo; ?!AMP?! bar) && 5 + 6 ! (foo; ?!AMP?! bar) >baz
+25 -25
t/chainlint/nested-cuddled-subshell.expect
··· 1 - ( 2 - (cd foo && 3 - bar 4 - ) && 5 - 6 - (cd foo && 7 - bar 8 - ) ?!AMP?! 9 - 10 - ( 11 - cd foo && 12 - bar) && 13 - 14 - ( 15 - cd foo && 16 - bar) ?!AMP?! 17 - 18 - (cd foo && 19 - bar) && 20 - 21 - (cd foo && 22 - bar) ?!AMP?! 23 - 24 - foobar 25 - )
··· 1 + 2 ( 2 + 3 (cd foo && 3 + 4 bar 4 + 5 ) && 5 + 6 6 + 7 (cd foo && 7 + 8 bar 8 + 9 ) ?!AMP?! 9 + 10 10 + 11 ( 11 + 12 cd foo && 12 + 13 bar) && 13 + 14 14 + 15 ( 15 + 16 cd foo && 16 + 17 bar) ?!AMP?! 17 + 18 18 + 19 (cd foo && 19 + 20 bar) && 20 + 21 21 + 22 (cd foo && 22 + 23 bar) ?!AMP?! 23 + 24 24 + 25 foobar 25 + 26 )
+30 -30
t/chainlint/nested-here-doc.expect
··· 1 - cat <<ARBITRARY >foop && 2 - naddle 3 - fub <<EOF 4 - nozzle 5 - noodle 6 - EOF 7 - formp 8 - ARBITRARY 9 - 10 - ( 11 - cat <<-\INPUT_END && 12 - fish are mice 13 - but geese go slow 14 - data <<EOF 15 - perl is lerp 16 - and nothing else 17 - EOF 18 - toink 19 - INPUT_END 20 - 21 - cat <<-\EOT ?!AMP?! 22 - text goes here 23 - data <<EOF 24 - data goes here 25 - EOF 26 - more test here 27 - EOT 28 - 29 - foobar 30 - )
··· 1 + 2 cat <<ARBITRARY >foop && 2 + 3 naddle 3 + 4 fub <<EOF 4 + 5 nozzle 5 + 6 noodle 6 + 7 EOF 7 + 8 formp 8 + 9 ARBITRARY 9 + 10 10 + 11 ( 11 + 12 cat <<-\INPUT_END && 12 + 13 fish are mice 13 + 14 but geese go slow 14 + 15 data <<EOF 15 + 16 perl is lerp 16 + 17 and nothing else 17 + 18 EOF 18 + 19 toink 19 + 20 INPUT_END 20 + 21 21 + 22 cat <<-\EOT ?!AMP?! 22 + 23 text goes here 23 + 24 data <<EOF 24 + 25 data goes here 25 + 26 EOF 26 + 27 more test here 27 + 28 EOT 28 + 29 29 + 30 foobar 30 + 31 )
+31 -31
t/chainlint/nested-loop-detect-failure.expect
··· 1 - for i in 0 1 2 3 4 5 6 7 8 9; 2 - do 3 - for j in 0 1 2 3 4 5 6 7 8 9; 4 - do 5 - echo "$i$j" >"path$i$j" ?!LOOP?! 6 - done ?!LOOP?! 7 - done && 8 - 9 - for i in 0 1 2 3 4 5 6 7 8 9; 10 - do 11 - for j in 0 1 2 3 4 5 6 7 8 9; 12 - do 13 - echo "$i$j" >"path$i$j" || return 1 14 - done 15 - done && 16 - 17 - for i in 0 1 2 3 4 5 6 7 8 9; 18 - do 19 - for j in 0 1 2 3 4 5 6 7 8 9; 20 - do 21 - echo "$i$j" >"path$i$j" ?!LOOP?! 22 - done || return 1 23 - done && 24 - 25 - for i in 0 1 2 3 4 5 6 7 8 9; 26 - do 27 - for j in 0 1 2 3 4 5 6 7 8 9; 28 - do 29 - echo "$i$j" >"path$i$j" || return 1 30 - done || return 1 31 - done
··· 1 + 2 for i in 0 1 2 3 4 5 6 7 8 9; 2 + 3 do 3 + 4 for j in 0 1 2 3 4 5 6 7 8 9; 4 + 5 do 5 + 6 echo "$i$j" >"path$i$j" ?!LOOP?! 6 + 7 done ?!LOOP?! 7 + 8 done && 8 + 9 9 + 10 for i in 0 1 2 3 4 5 6 7 8 9; 10 + 11 do 11 + 12 for j in 0 1 2 3 4 5 6 7 8 9; 12 + 13 do 13 + 14 echo "$i$j" >"path$i$j" || return 1 14 + 15 done 15 + 16 done && 16 + 17 17 + 18 for i in 0 1 2 3 4 5 6 7 8 9; 18 + 19 do 19 + 20 for j in 0 1 2 3 4 5 6 7 8 9; 20 + 21 do 21 + 22 echo "$i$j" >"path$i$j" ?!LOOP?! 22 + 23 done || return 1 23 + 24 done && 24 + 25 25 + 26 for i in 0 1 2 3 4 5 6 7 8 9; 26 + 27 do 27 + 28 for j in 0 1 2 3 4 5 6 7 8 9; 28 + 29 do 29 + 30 echo "$i$j" >"path$i$j" || return 1 30 + 31 done || return 1 31 + 32 done
+11 -11
t/chainlint/nested-subshell-comment.expect
··· 1 - ( 2 - foo && 3 - ( 4 - bar && 5 - # bottles wobble while fiddles gobble 6 - # minor numbers of cows (or do they?) 7 - baz && 8 - snaff 9 - ) ?!AMP?! 10 - fuzzy 11 - )
··· 1 + 2 ( 2 + 3 foo && 3 + 4 ( 4 + 5 bar && 5 + 6 # bottles wobble while fiddles gobble 6 + 7 # minor numbers of cows (or do they?) 7 + 8 baz && 8 + 9 snaff 9 + 10 ) ?!AMP?! 10 + 11 fuzzy 11 + 12 )
+13 -13
t/chainlint/nested-subshell.expect
··· 1 - ( 2 - cd foo && 3 - ( 4 - echo a && 5 - echo b 6 - ) >file && 7 - 8 - cd foo && 9 - ( 10 - echo a ?!AMP?! 11 - echo b 12 - ) >file 13 - )
··· 1 + 2 ( 2 + 3 cd foo && 3 + 4 ( 4 + 5 echo a && 5 + 6 echo b 6 + 7 ) >file && 7 + 8 8 + 9 cd foo && 9 + 10 ( 10 + 11 echo a ?!AMP?! 11 + 12 echo b 12 + 13 ) >file 13 + 14 )
+14 -14
t/chainlint/not-heredoc.expect
··· 1 - echo "<<<<<<< ours" && 2 - echo ourside && 3 - echo "=======" && 4 - echo theirside && 5 - echo ">>>>>>> theirs" && 6 - 7 - ( 8 - echo "<<<<<<< ours" && 9 - echo ourside && 10 - echo "=======" && 11 - echo theirside && 12 - echo ">>>>>>> theirs" ?!AMP?! 13 - poodle 14 - ) >merged
··· 1 + 2 echo "<<<<<<< ours" && 2 + 3 echo ourside && 3 + 4 echo "=======" && 4 + 5 echo theirside && 5 + 6 echo ">>>>>>> theirs" && 6 + 7 7 + 8 ( 8 + 9 echo "<<<<<<< ours" && 9 + 10 echo ourside && 10 + 11 echo "=======" && 11 + 12 echo theirside && 12 + 13 echo ">>>>>>> theirs" ?!AMP?! 13 + 14 poodle 14 + 15 ) >merged
+9 -9
t/chainlint/one-liner-for-loop.expect
··· 1 - git init dir-rename-and-content && 2 - ( 3 - cd dir-rename-and-content && 4 - test_write_lines 1 2 3 4 5 >foo && 5 - mkdir olddir && 6 - for i in a b c; do echo $i >olddir/$i; ?!LOOP?! done ?!AMP?! 7 - git add foo olddir && 8 - git commit -m "original" && 9 - )
··· 1 + 2 git init dir-rename-and-content && 2 + 3 ( 3 + 4 cd dir-rename-and-content && 4 + 5 test_write_lines 1 2 3 4 5 >foo && 5 + 6 mkdir olddir && 6 + 7 for i in a b c; do echo $i >olddir/$i; ?!LOOP?! done ?!AMP?! 7 + 8 git add foo olddir && 8 + 9 git commit -m "original" && 9 + 10 )
+9 -9
t/chainlint/one-liner.expect
··· 1 - (foo && bar) && 2 - (foo && bar) | 3 - (foo && bar) >baz && 4 - 5 - (foo; ?!AMP?! bar) && 6 - (foo; ?!AMP?! bar) | 7 - (foo; ?!AMP?! bar) >baz && 8 - 9 - (foo "bar; baz")
··· 1 + 2 (foo && bar) && 2 + 3 (foo && bar) | 3 + 4 (foo && bar) >baz && 4 + 5 5 + 6 (foo; ?!AMP?! bar) && 6 + 7 (foo; ?!AMP?! bar) | 7 + 8 (foo; ?!AMP?! bar) >baz && 8 + 9 9 + 10 (foo "bar; baz")
+4 -4
t/chainlint/p4-filespec.expect
··· 1 - ( 2 - p4 print -1 //depot/fiddle#42 >file && 3 - foobar 4 - )
··· 1 + 2 ( 2 + 3 p4 print -1 //depot/fiddle#42 >file && 3 + 4 foobar 4 + 5 )
+10 -10
t/chainlint/pipe.expect
··· 1 - ( 2 - foo | 3 - bar | 4 - baz && 5 - 6 - fish | 7 - cow ?!AMP?! 8 - 9 - sunder 10 - )
··· 1 + 2 ( 2 + 3 foo | 3 + 4 bar | 4 + 5 baz && 5 + 6 6 + 7 fish | 7 + 8 cow ?!AMP?! 8 + 9 9 + 10 sunder 10 + 11 )
+5 -5
t/chainlint/return-loop.expect
··· 1 - while test $i -lt $((num - 5)) 2 - do 3 - git notes add -m "notes for commit$i" HEAD~$i || return 1 4 - i=$((i + 1)) 5 - done
··· 1 + 2 while test $i -lt $((num - 5)) 2 + 3 do 3 + 4 git notes add -m "notes for commit$i" HEAD~$i || return 1 4 + 5 i=$((i + 1)) 5 + 6 done
+19 -19
t/chainlint/semicolon.expect
··· 1 - ( 2 - cat foo ; ?!AMP?! echo bar ?!AMP?! 3 - cat foo ; ?!AMP?! echo bar 4 - ) && 5 - ( 6 - cat foo ; ?!AMP?! echo bar && 7 - cat foo ; ?!AMP?! echo bar 8 - ) && 9 - ( 10 - echo "foo; bar" && 11 - cat foo; ?!AMP?! echo bar 12 - ) && 13 - ( 14 - foo; 15 - ) && 16 - (cd foo && 17 - for i in a b c; do 18 - echo; ?!LOOP?! 19 - done)
··· 1 + 2 ( 2 + 3 cat foo ; ?!AMP?! echo bar ?!AMP?! 3 + 4 cat foo ; ?!AMP?! echo bar 4 + 5 ) && 5 + 6 ( 6 + 7 cat foo ; ?!AMP?! echo bar && 7 + 8 cat foo ; ?!AMP?! echo bar 8 + 9 ) && 9 + 10 ( 10 + 11 echo "foo; bar" && 11 + 12 cat foo; ?!AMP?! echo bar 12 + 13 ) && 13 + 14 ( 14 + 15 foo; 15 + 16 ) && 16 + 17 (cd foo && 17 + 18 for i in a b c; do 18 + 19 echo; ?!LOOP?! 19 + 20 done)
+4 -4
t/chainlint/sqstring-in-sqstring.expect
··· 1 - perl -e ' 2 - defined($_ = -s $_) or die for @ARGV; 3 - exit 1 if $ARGV[0] <= $ARGV[1]; 4 - ' test-2-$packname_2.pack test-3-$packname_3.pack
··· 1 + 2 perl -e ' 2 + 3 defined($_ = -s $_) or die for @ARGV; 3 + 4 exit 1 if $ARGV[0] <= $ARGV[1]; 4 + 5 ' test-2-$packname_2.pack test-3-$packname_3.pack
+30 -30
t/chainlint/subshell-here-doc.expect
··· 1 - ( 2 - echo wobba \ 3 - gorgo snoot \ 4 - wafta snurb <<-EOF && 5 - quoth the raven, 6 - nevermore... 7 - EOF 8 - 9 - cat <<EOF >bip ?!AMP?! 10 - fish fly high 11 - EOF 12 - 13 - echo <<-\EOF >bop 14 - gomez 15 - morticia 16 - wednesday 17 - pugsly 18 - EOF 19 - ) && 20 - ( 21 - cat <<-\ARBITRARY >bup && 22 - glink 23 - FIZZ 24 - ARBITRARY 25 - cat <<-"ARBITRARY3" >bup3 && 26 - glink 27 - FIZZ 28 - ARBITRARY3 29 - meep 30 - )
··· 1 + 2 ( 2 + 3 echo wobba \ 3 + 4 gorgo snoot \ 4 + 5 wafta snurb <<-EOF && 5 + 6 quoth the raven, 6 + 7 nevermore... 7 + 8 EOF 8 + 9 9 + 10 cat <<EOF >bip ?!AMP?! 10 + 11 fish fly high 11 + 12 EOF 12 + 13 13 + 14 echo <<-\EOF >bop 14 + 15 gomez 15 + 16 morticia 16 + 17 wednesday 17 + 18 pugsly 18 + 19 EOF 19 + 20 ) && 20 + 21 ( 21 + 22 cat <<-\ARBITRARY >bup && 22 + 23 glink 23 + 24 FIZZ 24 + 25 ARBITRARY 25 + 26 cat <<-"ARBITRARY3" >bup3 && 26 + 27 glink 27 + 28 FIZZ 28 + 29 ARBITRARY3 29 + 30 meep 30 + 31 )
+19 -19
t/chainlint/subshell-one-liner.expect
··· 1 - ( 2 - (foo && bar) && 3 - (foo && bar) | 4 - (foo && bar) >baz && 5 - 6 - (foo; ?!AMP?! bar) && 7 - (foo; ?!AMP?! bar) | 8 - (foo; ?!AMP?! bar) >baz && 9 - 10 - (foo || exit 1) && 11 - (foo || exit 1) | 12 - (foo || exit 1) >baz && 13 - 14 - (foo && bar) ?!AMP?! 15 - 16 - (foo && bar; ?!AMP?! baz) ?!AMP?! 17 - 18 - foobar 19 - )
··· 1 + 2 ( 2 + 3 (foo && bar) && 3 + 4 (foo && bar) | 4 + 5 (foo && bar) >baz && 5 + 6 6 + 7 (foo; ?!AMP?! bar) && 7 + 8 (foo; ?!AMP?! bar) | 8 + 9 (foo; ?!AMP?! bar) >baz && 9 + 10 10 + 11 (foo || exit 1) && 11 + 12 (foo || exit 1) | 12 + 13 (foo || exit 1) >baz && 13 + 14 14 + 15 (foo && bar) ?!AMP?! 15 + 16 16 + 17 (foo && bar; ?!AMP?! baz) ?!AMP?! 17 + 18 18 + 19 foobar 19 + 20 )
+22 -22
t/chainlint/t7900-subtree.expect
··· 1 - ( 2 - chks="sub1 3 - sub2 4 - sub3 5 - sub4" && 6 - chks_sub=$(cat <<TXT | sed "s,^,sub dir/," 7 - $chks 8 - TXT 9 - ) && 10 - chkms="main-sub1 11 - main-sub2 12 - main-sub3 13 - main-sub4" && 14 - chkms_sub=$(cat <<TXT | sed "s,^,sub dir/," 15 - $chkms 16 - TXT 17 - ) && 18 - 19 - subfiles=$(git ls-files) && 20 - check_equal "$subfiles" "$chkms 21 - $chks" 22 - )
··· 1 + 2 ( 2 + 3 chks="sub1 3 + 4 sub2 4 + 5 sub3 5 + 6 sub4" && 6 + 7 chks_sub=$(cat <<TXT | sed "s,^,sub dir/," 7 + 8 $chks 8 + 9 TXT 9 + 10 ) && 10 + 11 chkms="main-sub1 11 + 12 main-sub2 12 + 13 main-sub3 13 + 14 main-sub4" && 14 + 15 chkms_sub=$(cat <<TXT | sed "s,^,sub dir/," 15 + 16 $chkms 16 + 17 TXT 17 + 18 ) && 18 + 19 19 + 20 subfiles=$(git ls-files) && 20 + 21 check_equal "$subfiles" "$chkms 21 + 22 $chks" 22 + 23 )
+27 -27
t/chainlint/token-pasting.expect
··· 1 - git config filter.rot13.smudge ./rot13.sh && 2 - git config filter.rot13.clean ./rot13.sh && 3 - 4 - { 5 - echo "*.t filter=rot13" ?!AMP?! 6 - echo "*.i ident" 7 - } >.gitattributes && 8 - 9 - { 10 - echo a b c d e f g h i j k l m ?!AMP?! 11 - echo n o p q r s t u v w x y z ?!AMP?! 12 - echo '$Id$' 13 - } >test && 14 - cat test >test.t && 15 - cat test >test.o && 16 - cat test >test.i && 17 - git add test test.t test.i && 18 - rm -f test test.t test.i && 19 - git checkout -- test test.t test.i && 20 - 21 - echo "content-test2" >test2.o && 22 - echo "content-test3 - filename with special characters" >"test3 'sq',$x=.o" ?!AMP?! 23 - 24 - downstream_url_for_sed=$( 25 - printf "%sn" "$downstream_url" | 26 - sed -e 's/\/\\/g' -e 's/[[/.*^$]/\&/g' 27 - )
··· 1 + 2 git config filter.rot13.smudge ./rot13.sh && 2 + 3 git config filter.rot13.clean ./rot13.sh && 3 + 4 4 + 5 { 5 + 6 echo "*.t filter=rot13" ?!AMP?! 6 + 7 echo "*.i ident" 7 + 8 } >.gitattributes && 8 + 9 9 + 10 { 10 + 11 echo a b c d e f g h i j k l m ?!AMP?! 11 + 12 echo n o p q r s t u v w x y z ?!AMP?! 12 + 13 echo '$Id$' 13 + 14 } >test && 14 + 15 cat test >test.t && 15 + 16 cat test >test.o && 16 + 17 cat test >test.i && 17 + 18 git add test test.t test.i && 18 + 19 rm -f test test.t test.i && 19 + 20 git checkout -- test test.t test.i && 20 + 21 21 + 22 echo "content-test2" >test2.o && 22 + 23 echo "content-test3 - filename with special characters" >"test3 'sq',$x=.o" ?!AMP?! 23 + 24 24 + 25 downstream_url_for_sed=$( 25 + 26 printf "%sn" "$downstream_url" | 26 + 27 sed -e 's/\/\\/g' -e 's/[[/.*^$]/\&/g' 27 + 28 )
+4 -4
t/chainlint/unclosed-here-doc-indent.expect
··· 1 - command_which_is_run && 2 - cat >expect <<-\EOF ?!UNCLOSED-HEREDOC?! && 3 - we forget to end the here-doc 4 - command_which_is_gobbled
··· 1 + 2 command_which_is_run && 2 + 3 cat >expect <<-\EOF ?!UNCLOSED-HEREDOC?! && 3 + 4 we forget to end the here-doc 4 + 5 command_which_is_gobbled
+7 -7
t/chainlint/unclosed-here-doc.expect
··· 1 - command_which_is_run && 2 - cat >expect <<\EOF ?!UNCLOSED-HEREDOC?! && 3 - we try to end the here-doc below, 4 - but the indentation throws us off 5 - since the operator is not "<<-". 6 - EOF 7 - command_which_is_gobbled
··· 1 + 2 command_which_is_run && 2 + 3 cat >expect <<\EOF ?!UNCLOSED-HEREDOC?! && 3 + 4 we try to end the here-doc below, 4 + 5 but the indentation throws us off 5 + 6 since the operator is not "<<-". 6 + 7 EOF 7 + 8 command_which_is_gobbled
+14 -14
t/chainlint/while-loop.expect
··· 1 - ( 2 - while true 3 - do 4 - echo foo ?!AMP?! 5 - cat <<-\EOF ?!LOOP?! 6 - bar 7 - EOF 8 - done ?!AMP?! 9 - 10 - while true; do 11 - echo foo && 12 - cat bar ?!LOOP?! 13 - done 14 - )
··· 1 + 2 ( 2 + 3 while true 3 + 4 do 4 + 5 echo foo ?!AMP?! 5 + 6 cat <<-\EOF ?!LOOP?! 6 + 7 bar 7 + 8 EOF 8 + 9 done ?!AMP?! 9 + 10 10 + 11 while true; do 11 + 12 echo foo && 12 + 13 cat bar ?!LOOP?! 13 + 14 done 14 + 15 )