Browse Source

tests: do not use implicit "git diff --no-index"

As a general principle, we should not use "git diff" to validate the
results of what git command that is being tested has done.  We would not
know if we are testing the command in question, or locating a bug in the
cute hack of "git diff --no-index".

Rather use test_cmp for that purpose.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Junio C Hamano 17 years ago
parent
commit
3af828634f
  1. 6
      t/diff-lib.sh
  2. 156
      t/t0030-stripspace.sh
  3. 18
      t/t0040-parse-options.sh
  4. 2
      t/t1000-read-tree-m-3way.sh
  5. 26
      t/t1001-read-tree-m-2way.sh
  6. 2
      t/t1002-read-tree-m-u-2way.sh
  7. 8
      t/t1300-repo-config.sh
  8. 2
      t/t1303-wacky-config.sh
  9. 2
      t/t1502-rev-parse-parseopt.sh
  10. 4
      t/t3001-ls-files-others-exclude.sh
  11. 10
      t/t3002-ls-files-dashpath.sh
  12. 42
      t/t3030-merge-recursive.sh
  13. 4
      t/t3040-subprojects-basic.sh
  14. 2
      t/t3100-ls-tree-restrict.sh
  15. 2
      t/t3101-ls-tree-dirname.sh
  16. 30
      t/t3300-funny-names.sh
  17. 2
      t/t3900-i18n-commit.sh
  18. 2
      t/t4006-diff-mode.sh
  19. 2
      t/t4013-diff-various.sh
  20. 2
      t/t4014-format-patch.sh
  21. 12
      t/t4015-diff-whitespace.sh
  22. 4
      t/t4016-diff-quote.sh
  23. 8
      t/t4018-diff-funcname.sh
  24. 14
      t/t4100-apply-stat.sh
  25. 4
      t/t4104-apply-boundary.sh
  26. 4
      t/t4115-apply-symlink.sh
  27. 2
      t/t4116-apply-reverse.sh
  28. 12
      t/t4117-apply-reject.sh
  29. 6
      t/t4118-apply-empty-context.sh
  30. 6
      t/t4200-rerere.sh
  31. 4
      t/t5305-include-tag.sh
  32. 2
      t/t5400-send-pack.sh
  33. 10
      t/t5401-update-hooks.sh
  34. 8
      t/t5503-tagfollow.sh
  35. 10
      t/t5505-remote.sh
  36. 4
      t/t5515-fetch-merge-logic.sh
  37. 2
      t/t6006-rev-list-format.sh
  38. 8
      t/t6023-merge-file.sh
  39. 4
      t/t6024-recursive-merge.sh
  40. 4
      t/t6029-merge-subtree.sh
  41. 2
      t/t6120-describe.sh
  42. 16
      t/t6200-fmt-merge-msg.sh
  43. 24
      t/t6300-for-each-ref.sh
  44. 4
      t/t7003-filter-branch.sh
  45. 210
      t/t7004-tag.sh
  46. 12
      t/t7102-reset.sh
  47. 6
      t/t7502-status.sh
  48. 6
      t/t9100-git-svn-basic.sh
  49. 34
      t/t9300-fast-import.sh
  50. 8
      t/t9600-cvsimport.sh

6
t/diff-lib.sh

@ -11,7 +11,7 @@ compare_diff_raw () {


sed -e "$sanitize_diff_raw" <"$1" >.tmp-1 sed -e "$sanitize_diff_raw" <"$1" >.tmp-1
sed -e "$sanitize_diff_raw" <"$2" >.tmp-2 sed -e "$sanitize_diff_raw" <"$2" >.tmp-2
git diff .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
} }


sanitize_diff_raw_z='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]*$/ X X \1#/' sanitize_diff_raw_z='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]*$/ X X \1#/'
@ -23,7 +23,7 @@ compare_diff_raw_z () {


perl -pe 'y/\000/\012/' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1 perl -pe 'y/\000/\012/' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
perl -pe 'y/\000/\012/' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2 perl -pe 'y/\000/\012/' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
git diff .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
} }


compare_diff_patch () { compare_diff_patch () {
@ -37,5 +37,5 @@ compare_diff_patch () {
/^[dis]*imilarity index [0-9]*%$/d /^[dis]*imilarity index [0-9]*%$/d
/^index [0-9a-f]*\.\.[0-9a-f]/d /^index [0-9a-f]*\.\.[0-9a-f]/d
' <"$2" >.tmp-2 ' <"$2" >.tmp-2
git diff .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
} }

156
t/t0030-stripspace.sh

@ -16,96 +16,96 @@ test_expect_success \
'long lines without spaces should be unchanged' ' 'long lines without spaces should be unchanged' '
echo "$ttt" >expect && echo "$ttt" >expect &&
git stripspace <expect >actual && git stripspace <expect >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$ttt$ttt" >expect && echo "$ttt$ttt" >expect &&
git stripspace <expect >actual && git stripspace <expect >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$ttt$ttt$ttt" >expect && echo "$ttt$ttt$ttt" >expect &&
git stripspace <expect >actual && git stripspace <expect >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$ttt$ttt$ttt$ttt" >expect && echo "$ttt$ttt$ttt$ttt" >expect &&
git stripspace <expect >actual && git stripspace <expect >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
'lines with spaces at the beginning should be unchanged' ' 'lines with spaces at the beginning should be unchanged' '
echo "$sss$ttt" >expect && echo "$sss$ttt" >expect &&
git stripspace <expect >actual && git stripspace <expect >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$sss$sss$ttt" >expect && echo "$sss$sss$ttt" >expect &&
git stripspace <expect >actual && git stripspace <expect >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$sss$sss$sss$ttt" >expect && echo "$sss$sss$sss$ttt" >expect &&
git stripspace <expect >actual && git stripspace <expect >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
'lines with intermediate spaces should be unchanged' ' 'lines with intermediate spaces should be unchanged' '
echo "$ttt$sss$ttt" >expect && echo "$ttt$sss$ttt" >expect &&
git stripspace <expect >actual && git stripspace <expect >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$ttt$sss$sss$ttt" >expect && echo "$ttt$sss$sss$ttt" >expect &&
git stripspace <expect >actual && git stripspace <expect >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
'consecutive blank lines should be unified' ' 'consecutive blank lines should be unified' '
printf "$ttt\n\n$ttt\n" > expect && printf "$ttt\n\n$ttt\n" > expect &&
printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt\n\n$ttt\n" > expect && printf "$ttt$ttt\n\n$ttt\n" > expect &&
printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt$ttt\n\n$ttt\n" > expect && printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n$ttt\n" > expect && printf "$ttt\n\n$ttt\n" > expect &&
printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n$ttt$ttt\n" > expect && printf "$ttt\n\n$ttt$ttt\n" > expect &&
printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git stripspace >actual && printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual && printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n$ttt\n" > expect && printf "$ttt\n\n$ttt\n" > expect &&
printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt\n\n$ttt\n" > expect && printf "$ttt$ttt\n\n$ttt\n" > expect &&
printf "$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && printf "$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt$ttt\n\n$ttt\n" > expect && printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
printf "$ttt$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && printf "$ttt$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n$ttt\n" > expect && printf "$ttt\n\n$ttt\n" > expect &&
printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n$ttt$ttt\n" > expect && printf "$ttt\n\n$ttt$ttt\n" > expect &&
printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt\n" | git stripspace >actual && printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt$ttt\n" | git stripspace >actual && printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt$ttt\n" | git stripspace >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
@ -113,114 +113,114 @@ test_expect_success \
> expect && > expect &&


printf "\n" | git stripspace >actual && printf "\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "\n\n\n" | git stripspace >actual && printf "\n\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$sss\n$sss\n$sss\n" | git stripspace >actual && printf "$sss\n$sss\n$sss\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$sss$sss\n$sss\n\n" | git stripspace >actual && printf "$sss$sss\n$sss\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "\n$sss\n$sss$sss\n" | git stripspace >actual && printf "\n$sss\n$sss$sss\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual && printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual && printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual && printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
'consecutive blank lines at the beginning should be removed' ' 'consecutive blank lines at the beginning should be removed' '
printf "$ttt\n" > expect && printf "$ttt\n" > expect &&
printf "\n$ttt\n" | git stripspace >actual && printf "\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n" > expect && printf "$ttt\n" > expect &&
printf "\n\n\n$ttt\n" | git stripspace >actual && printf "\n\n\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt\n" > expect && printf "$ttt$ttt\n" > expect &&
printf "\n\n\n$ttt$ttt\n" | git stripspace >actual && printf "\n\n\n$ttt$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt$ttt\n" > expect && printf "$ttt$ttt$ttt\n" > expect &&
printf "\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual && printf "\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt$ttt$ttt\n" > expect && printf "$ttt$ttt$ttt$ttt\n" > expect &&
printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git stripspace >actual && printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n" > expect && printf "$ttt\n" > expect &&


printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual && printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual && printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual && printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual && printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual && printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual && printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
'consecutive blank lines at the end should be removed' ' 'consecutive blank lines at the end should be removed' '
printf "$ttt\n" > expect && printf "$ttt\n" > expect &&
printf "$ttt\n\n" | git stripspace >actual && printf "$ttt\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n" > expect && printf "$ttt\n" > expect &&
printf "$ttt\n\n\n\n" | git stripspace >actual && printf "$ttt\n\n\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt\n" > expect && printf "$ttt$ttt\n" > expect &&
printf "$ttt$ttt\n\n\n\n" | git stripspace >actual && printf "$ttt$ttt\n\n\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt$ttt\n" > expect && printf "$ttt$ttt$ttt\n" > expect &&
printf "$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual && printf "$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt$ttt$ttt\n" > expect && printf "$ttt$ttt$ttt$ttt\n" > expect &&
printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual && printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n" > expect && printf "$ttt\n" > expect &&


printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual && printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual && printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual && printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual && printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual && printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual && printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
@ -257,27 +257,27 @@ test_expect_success \
'text plus spaces without newline should show the correct lines' ' 'text plus spaces without newline should show the correct lines' '
printf "$ttt\n" >expect && printf "$ttt\n" >expect &&
printf "$ttt$sss" | git stripspace >actual && printf "$ttt$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n" >expect && printf "$ttt\n" >expect &&
printf "$ttt$sss$sss" | git stripspace >actual && printf "$ttt$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n" >expect && printf "$ttt\n" >expect &&
printf "$ttt$sss$sss$sss" | git stripspace >actual && printf "$ttt$sss$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt\n" >expect && printf "$ttt$ttt\n" >expect &&
printf "$ttt$ttt$sss" | git stripspace >actual && printf "$ttt$ttt$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt\n" >expect && printf "$ttt$ttt\n" >expect &&
printf "$ttt$ttt$sss$sss" | git stripspace >actual && printf "$ttt$ttt$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt$ttt\n" >expect && printf "$ttt$ttt$ttt\n" >expect &&
printf "$ttt$ttt$ttt$sss" | git stripspace >actual && printf "$ttt$ttt$ttt$sss" | git stripspace >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
@ -294,27 +294,27 @@ test_expect_success \
'text plus spaces at end should be cleaned and newline must remain' ' 'text plus spaces at end should be cleaned and newline must remain' '
echo "$ttt" >expect && echo "$ttt" >expect &&
echo "$ttt$sss" | git stripspace >actual && echo "$ttt$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$ttt" >expect && echo "$ttt" >expect &&
echo "$ttt$sss$sss" | git stripspace >actual && echo "$ttt$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$ttt" >expect && echo "$ttt" >expect &&
echo "$ttt$sss$sss$sss" | git stripspace >actual && echo "$ttt$sss$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$ttt$ttt" >expect && echo "$ttt$ttt" >expect &&
echo "$ttt$ttt$sss" | git stripspace >actual && echo "$ttt$ttt$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$ttt$ttt" >expect && echo "$ttt$ttt" >expect &&
echo "$ttt$ttt$sss$sss" | git stripspace >actual && echo "$ttt$ttt$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$ttt$ttt$ttt" >expect && echo "$ttt$ttt$ttt" >expect &&
echo "$ttt$ttt$ttt$sss" | git stripspace >actual && echo "$ttt$ttt$ttt$sss" | git stripspace >actual &&
git diff expect actual test_cmp expect actual
' '


# spaces only: # spaces only:
@ -324,19 +324,19 @@ test_expect_success \
printf "" >expect && printf "" >expect &&


echo | git stripspace >actual && echo | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$sss" | git stripspace >actual && echo "$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$sss$sss" | git stripspace >actual && echo "$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$sss$sss$sss" | git stripspace >actual && echo "$sss$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


echo "$sss$sss$sss$sss" | git stripspace >actual && echo "$sss$sss$sss$sss" | git stripspace >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
@ -353,43 +353,43 @@ test_expect_success \
printf "" >expect && printf "" >expect &&


printf "" | git stripspace >actual && printf "" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$sss$sss" | git stripspace >actual && printf "$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$sss$sss$sss" | git stripspace >actual && printf "$sss$sss$sss" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$sss$sss$sss$sss" | git stripspace >actual && printf "$sss$sss$sss$sss" | git stripspace >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
'consecutive text lines should be unchanged' ' 'consecutive text lines should be unchanged' '
printf "$ttt$ttt\n$ttt\n" >expect && printf "$ttt$ttt\n$ttt\n" >expect &&
printf "$ttt$ttt\n$ttt\n" | git stripspace >actual && printf "$ttt$ttt\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n$ttt$ttt\n$ttt\n" >expect && printf "$ttt\n$ttt$ttt\n$ttt\n" >expect &&
printf "$ttt\n$ttt$ttt\n$ttt\n" | git stripspace >actual && printf "$ttt\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" >expect && printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" >expect &&
printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" | git stripspace >actual && printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" >expect && printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" >expect &&
printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" | git stripspace >actual && printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" >expect && printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" >expect &&
printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" | git stripspace >actual && printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
git diff expect actual && test_cmp expect actual &&


printf "$ttt\n$ttt$ttt\n\n$ttt\n" >expect && printf "$ttt\n$ttt$ttt\n\n$ttt\n" >expect &&
printf "$ttt\n$ttt$ttt\n\n$ttt\n" | git stripspace >actual && printf "$ttt\n$ttt$ttt\n\n$ttt\n" | git stripspace >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success 'strip comments, too' ' test_expect_success 'strip comments, too' '

18
t/t0040-parse-options.sh

@ -29,7 +29,7 @@ EOF
test_expect_success 'test help' ' test_expect_success 'test help' '
! test-parse-options -h > output 2> output.err && ! test-parse-options -h > output 2> output.err &&
test ! -s output && test ! -s output &&
git diff expect.err output.err test_cmp expect.err output.err
' '


cat > expect << EOF cat > expect << EOF
@ -40,7 +40,7 @@ EOF


test_expect_success 'short options' ' test_expect_success 'short options' '
test-parse-options -s123 -b -i 1729 -b > output 2> output.err && test-parse-options -s123 -b -i 1729 -b > output 2> output.err &&
git diff expect output && test_cmp expect output &&
test ! -s output.err test ! -s output.err
' '
cat > expect << EOF cat > expect << EOF
@ -53,7 +53,7 @@ test_expect_success 'long options' '
test-parse-options --boolean --integer 1729 --boolean --string2=321 \ test-parse-options --boolean --integer 1729 --boolean --string2=321 \
> output 2> output.err && > output 2> output.err &&
test ! -s output.err && test ! -s output.err &&
git diff expect output test_cmp expect output
' '


cat > expect << EOF cat > expect << EOF
@ -69,7 +69,7 @@ test_expect_success 'intermingled arguments' '
test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \ test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
> output 2> output.err && > output 2> output.err &&
test ! -s output.err && test ! -s output.err &&
git diff expect output test_cmp expect output
' '


cat > expect << EOF cat > expect << EOF
@ -81,13 +81,13 @@ EOF
test_expect_success 'unambiguously abbreviated option' ' test_expect_success 'unambiguously abbreviated option' '
test-parse-options --int 2 --boolean --no-bo > output 2> output.err && test-parse-options --int 2 --boolean --no-bo > output 2> output.err &&
test ! -s output.err && test ! -s output.err &&
git diff expect output test_cmp expect output
' '


test_expect_success 'unambiguously abbreviated option with "="' ' test_expect_success 'unambiguously abbreviated option with "="' '
test-parse-options --int=2 > output 2> output.err && test-parse-options --int=2 > output 2> output.err &&
test ! -s output.err && test ! -s output.err &&
git diff expect output test_cmp expect output
' '


test_expect_success 'ambiguously abbreviated option' ' test_expect_success 'ambiguously abbreviated option' '
@ -104,7 +104,7 @@ EOF
test_expect_success 'non ambiguous option (after two options it abbreviates)' ' test_expect_success 'non ambiguous option (after two options it abbreviates)' '
test-parse-options --st 123 > output 2> output.err && test-parse-options --st 123 > output 2> output.err &&
test ! -s output.err && test ! -s output.err &&
git diff expect output test_cmp expect output
' '


cat > expect.err << EOF cat > expect.err << EOF
@ -114,7 +114,7 @@ EOF
test_expect_success 'detect possible typos' ' test_expect_success 'detect possible typos' '
! test-parse-options -boolean > output 2> output.err && ! test-parse-options -boolean > output 2> output.err &&
test ! -s output && test ! -s output &&
git diff expect.err output.err test_cmp expect.err output.err
' '


cat > expect <<EOF cat > expect <<EOF
@ -127,7 +127,7 @@ EOF
test_expect_success 'keep some options as arguments' ' test_expect_success 'keep some options as arguments' '
test-parse-options --quux > output 2> output.err && test-parse-options --quux > output 2> output.err &&
test ! -s output.err && test ! -s output.err &&
git diff expect output test_cmp expect output
' '


test_done test_done

2
t/t1000-read-tree-m-3way.sh

@ -131,7 +131,7 @@ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"


check_result () { check_result () {
git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current && git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
git diff expected current test_cmp expected current
} }


# This is done on an empty work directory, which is the normal # This is done on an empty work directory, which is the normal

26
t/t1001-read-tree-m-2way.sh

@ -33,7 +33,7 @@ compare_change () {
-e '/^--- /d; /^+++ /d; /^@@ /d;' \ -e '/^--- /d; /^+++ /d; /^@@ /d;' \
-e 's/^\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /p' \ -e 's/^\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /p' \
"$1" "$1"
git diff expected current test_cmp expected current
} }


check_cache_at () { check_cache_at () {
@ -86,7 +86,7 @@ test_expect_success \
'rm -f .git/index && 'rm -f .git/index &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >1-3.out && git ls-files --stage >1-3.out &&
git diff M.out 1-3.out && test_cmp M.out 1-3.out &&
check_cache_at bozbar dirty && check_cache_at bozbar dirty &&
check_cache_at frotz dirty && check_cache_at frotz dirty &&
check_cache_at nitfol dirty' check_cache_at nitfol dirty'
@ -101,7 +101,7 @@ test_expect_success \
git update-index --add yomin && git update-index --add yomin &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >4.out || return 1 git ls-files --stage >4.out || return 1
git diff M.out 4.out >4diff.out git diff --no-index M.out 4.out >4diff.out
compare_change 4diff.out expected && compare_change 4diff.out expected &&
check_cache_at yomin clean' check_cache_at yomin clean'


@ -115,7 +115,7 @@ test_expect_success \
echo yomin yomin >yomin && echo yomin yomin >yomin &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >5.out || return 1 git ls-files --stage >5.out || return 1
git diff M.out 5.out >5diff.out git diff --no-index M.out 5.out >5diff.out
compare_change 5diff.out expected && compare_change 5diff.out expected &&
check_cache_at yomin dirty' check_cache_at yomin dirty'


@ -127,7 +127,7 @@ test_expect_success \
git update-index --add frotz && git update-index --add frotz &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >6.out && git ls-files --stage >6.out &&
git diff M.out 6.out && test_cmp M.out 6.out &&
check_cache_at frotz clean' check_cache_at frotz clean'


test_expect_success \ test_expect_success \
@ -140,7 +140,7 @@ test_expect_success \
echo frotz frotz >frotz && echo frotz frotz >frotz &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >7.out && git ls-files --stage >7.out &&
git diff M.out 7.out && test_cmp M.out 7.out &&
check_cache_at frotz dirty' check_cache_at frotz dirty'


test_expect_success \ test_expect_success \
@ -171,7 +171,7 @@ test_expect_success \
git update-index --add rezrov && git update-index --add rezrov &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >10.out && git ls-files --stage >10.out &&
git diff M.out 10.out' test_cmp M.out 10.out'


test_expect_success \ test_expect_success \
'11 - dirty path removed.' \ '11 - dirty path removed.' \
@ -216,7 +216,7 @@ test_expect_success \
git update-index --add nitfol && git update-index --add nitfol &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >14.out || return 1 git ls-files --stage >14.out || return 1
git diff M.out 14.out >14diff.out git diff --no-index M.out 14.out >14diff.out
compare_change 14diff.out expected && compare_change 14diff.out expected &&
check_cache_at nitfol clean' check_cache_at nitfol clean'


@ -230,7 +230,7 @@ test_expect_success \
echo nitfol nitfol nitfol >nitfol && echo nitfol nitfol nitfol >nitfol &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >15.out || return 1 git ls-files --stage >15.out || return 1
git diff M.out 15.out >15diff.out git diff --no-index M.out 15.out >15diff.out
compare_change 15diff.out expected && compare_change 15diff.out expected &&
check_cache_at nitfol dirty' check_cache_at nitfol dirty'


@ -262,7 +262,7 @@ test_expect_success \
git update-index --add bozbar && git update-index --add bozbar &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >18.out && git ls-files --stage >18.out &&
git diff M.out 18.out && test_cmp M.out 18.out &&
check_cache_at bozbar clean' check_cache_at bozbar clean'


test_expect_success \ test_expect_success \
@ -275,7 +275,7 @@ test_expect_success \
echo gnusto gnusto >bozbar && echo gnusto gnusto >bozbar &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >19.out && git ls-files --stage >19.out &&
git diff M.out 19.out && test_cmp M.out 19.out &&
check_cache_at bozbar dirty' check_cache_at bozbar dirty'


test_expect_success \ test_expect_success \
@ -287,7 +287,7 @@ test_expect_success \
git update-index --add bozbar && git update-index --add bozbar &&
read_tree_twoway $treeH $treeM && read_tree_twoway $treeH $treeM &&
git ls-files --stage >20.out && git ls-files --stage >20.out &&
git diff M.out 20.out && test_cmp M.out 20.out &&
check_cache_at bozbar dirty' check_cache_at bozbar dirty'


test_expect_success \ test_expect_success \
@ -337,7 +337,7 @@ test_expect_success \
git update-index --add DF && git update-index --add DF &&
read_tree_twoway $treeDF $treeDFDF && read_tree_twoway $treeDF $treeDFDF &&
git ls-files --stage >DFDFcheck.out && git ls-files --stage >DFDFcheck.out &&
git diff DFDF.out DFDFcheck.out && test_cmp DFDF.out DFDFcheck.out &&
check_cache_at DF/DF dirty && check_cache_at DF/DF dirty &&
:' :'



2
t/t1002-read-tree-m-u-2way.sh

@ -16,7 +16,7 @@ compare_change () {
sed >current \ sed >current \
-e '/^--- /d; /^+++ /d; /^@@ /d;' \ -e '/^--- /d; /^+++ /d; /^@@ /d;' \
-e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1" -e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1"
git diff expected current test_cmp expected current
} }


check_cache_at () { check_cache_at () {

8
t/t1300-repo-config.sh

@ -427,13 +427,13 @@ cat > expect << EOF
weird weird
EOF EOF


test_expect_success "rename succeeded" "git diff expect .git/config" test_expect_success "rename succeeded" "test_cmp expect .git/config"


test_expect_success "rename non-existing section" ' test_expect_success "rename non-existing section" '
! git config --rename-section branch."world domination" branch.drei ! git config --rename-section branch."world domination" branch.drei
' '


test_expect_success "rename succeeded" "git diff expect .git/config" test_expect_success "rename succeeded" "test_cmp expect .git/config"


test_expect_success "rename another section" \ test_expect_success "rename another section" \
'git config --rename-section branch."1 234 blabl/a" branch.drei' 'git config --rename-section branch."1 234 blabl/a" branch.drei'
@ -449,7 +449,7 @@ cat > expect << EOF
weird weird
EOF EOF


test_expect_success "rename succeeded" "git diff expect .git/config" test_expect_success "rename succeeded" "test_cmp expect .git/config"


cat >> .git/config << EOF cat >> .git/config << EOF
[branch "zwei"] a = 1 [branch "vier"] [branch "zwei"] a = 1 [branch "vier"]
@ -465,7 +465,7 @@ weird
EOF EOF


test_expect_success "section was removed properly" \ test_expect_success "section was removed properly" \
"git diff -u expect .git/config" "test_cmp expect .git/config"


rm .git/config rm .git/config



2
t/t1303-wacky-config.sh

@ -11,7 +11,7 @@ setup() {
check() { check() {
echo "$2" >expected echo "$2" >expected
git config --get "$1" >actual git config --get "$1" >actual
git diff actual expected test_cmp actual expected
} }


test_expect_success 'modify same key' ' test_expect_success 'modify same key' '

2
t/t1502-rev-parse-parseopt.sh

@ -37,7 +37,7 @@ C? option C with an optional argument
Extras Extras
extra1 line above used to cause a segfault but no longer does extra1 line above used to cause a segfault but no longer does
EOF EOF
git diff expect.err output.err test_cmp expect.err output.err
' '


test_done test_done

4
t/t3001-ls-files-others-exclude.sh

@ -65,7 +65,7 @@ test_expect_success \
--exclude-per-directory=.gitignore \ --exclude-per-directory=.gitignore \
--exclude-from=.git/ignore \ --exclude-from=.git/ignore \
>output && >output &&
git diff expect output' test_cmp expect output'


# Test \r\n (MSDOS-like systems) # Test \r\n (MSDOS-like systems)
printf '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore printf '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore
@ -77,7 +77,7 @@ test_expect_success \
--exclude-per-directory=.gitignore \ --exclude-per-directory=.gitignore \
--exclude-from=.git/ignore \ --exclude-from=.git/ignore \
>output && >output &&
git diff expect output' test_cmp expect output'


cat > excludes-file << EOF cat > excludes-file << EOF
*.[1-8] *.[1-8]

10
t/t3002-ls-files-dashpath.sh

@ -23,7 +23,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'git ls-files without path restriction.' \ 'git ls-files without path restriction.' \
'git ls-files --others >output && 'git ls-files --others >output &&
git diff output - <<EOF test_cmp output - <<EOF
-- --
-foo -foo
output output
@ -34,7 +34,7 @@ EOF
test_expect_success \ test_expect_success \
'git ls-files with path restriction.' \ 'git ls-files with path restriction.' \
'git ls-files --others path0 >output && 'git ls-files --others path0 >output &&
git diff output - <<EOF test_cmp output - <<EOF
path0 path0
EOF EOF
' '
@ -42,7 +42,7 @@ EOF
test_expect_success \ test_expect_success \
'git ls-files with path restriction with --.' \ 'git ls-files with path restriction with --.' \
'git ls-files --others -- path0 >output && 'git ls-files --others -- path0 >output &&
git diff output - <<EOF test_cmp output - <<EOF
path0 path0
EOF EOF
' '
@ -50,7 +50,7 @@ EOF
test_expect_success \ test_expect_success \
'git ls-files with path restriction with -- --.' \ 'git ls-files with path restriction with -- --.' \
'git ls-files --others -- -- >output && 'git ls-files --others -- -- >output &&
git diff output - <<EOF test_cmp output - <<EOF
-- --
EOF EOF
' '
@ -58,7 +58,7 @@ EOF
test_expect_success \ test_expect_success \
'git ls-files with no path restriction.' \ 'git ls-files with no path restriction.' \
'git ls-files --others -- >output && 'git ls-files --others -- >output &&
git diff output - <<EOF test_cmp output - <<EOF
-- --
-foo -foo
output output

42
t/t3030-merge-recursive.sh

@ -43,7 +43,7 @@ test_expect_success 'setup 1' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e" echo "100644 $o1 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual
' '


test_expect_success 'setup 2' ' test_expect_success 'setup 2' '
@ -61,7 +61,7 @@ test_expect_success 'setup 2' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o0 0 d/e" echo "100644 $o0 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual && test_cmp expected actual &&


echo goodbye >>a && echo goodbye >>a &&
o2=$(git hash-object a) && o2=$(git hash-object a) &&
@ -82,7 +82,7 @@ test_expect_success 'setup 2' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o0 0 d/e" echo "100644 $o0 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual
' '


test_expect_success 'setup 3' ' test_expect_success 'setup 3' '
@ -100,7 +100,7 @@ test_expect_success 'setup 3' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o0 0 d/e" echo "100644 $o0 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual && test_cmp expected actual &&


rm -f b && mkdir b && echo df-1 >b/c && git add b/c && rm -f b && mkdir b && echo df-1 >b/c && git add b/c &&
o3=$(git hash-object b/c) && o3=$(git hash-object b/c) &&
@ -119,7 +119,7 @@ test_expect_success 'setup 3' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o0 0 d/e" echo "100644 $o0 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual
' '


test_expect_success 'setup 4' ' test_expect_success 'setup 4' '
@ -137,7 +137,7 @@ test_expect_success 'setup 4' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o0 0 d/e" echo "100644 $o0 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual && test_cmp expected actual &&


rm -f a && mkdir a && echo df-2 >a/c && git add a/c && rm -f a && mkdir a && echo df-2 >a/c && git add a/c &&
o4=$(git hash-object a/c) && o4=$(git hash-object a/c) &&
@ -156,7 +156,7 @@ test_expect_success 'setup 4' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o0 0 d/e" echo "100644 $o0 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual
' '


test_expect_success 'setup 5' ' test_expect_success 'setup 5' '
@ -174,7 +174,7 @@ test_expect_success 'setup 5' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o0 0 d/e" echo "100644 $o0 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual && test_cmp expected actual &&


rm -f b && rm -f b &&
echo remove-conflict >a && echo remove-conflict >a &&
@ -195,7 +195,7 @@ test_expect_success 'setup 5' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o0 0 d/e" echo "100644 $o0 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


' '


@ -214,7 +214,7 @@ test_expect_success 'setup 6' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o0 0 d/e" echo "100644 $o0 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual && test_cmp expected actual &&


rm -fr d && echo df-3 >d && git add d && rm -fr d && echo df-3 >d && git add d &&
o6=$(git hash-object d) && o6=$(git hash-object d) &&
@ -233,7 +233,7 @@ test_expect_success 'setup 6' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o6 0 d" echo "100644 $o6 0 d"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual
' '


test_expect_success 'merge-recursive simple' ' test_expect_success 'merge-recursive simple' '
@ -265,7 +265,7 @@ test_expect_success 'merge-recursive result' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e" echo "100644 $o1 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


' '


@ -297,7 +297,7 @@ test_expect_success 'merge-recursive remove conflict' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e" echo "100644 $o1 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


' '


@ -318,7 +318,7 @@ test_expect_success 'merge-recursive result' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e" echo "100644 $o1 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


' '


@ -352,7 +352,7 @@ test_expect_success 'merge-recursive d/f conflict result' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e" echo "100644 $o1 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


' '


@ -386,7 +386,7 @@ test_expect_success 'merge-recursive d/f conflict result the other way' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e" echo "100644 $o1 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


' '


@ -420,7 +420,7 @@ test_expect_success 'merge-recursive d/f conflict result' '
echo "100644 $o0 1 d/e" echo "100644 $o0 1 d/e"
echo "100644 $o1 2 d/e" echo "100644 $o1 2 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


' '


@ -454,7 +454,7 @@ test_expect_success 'merge-recursive d/f conflict result' '
echo "100644 $o0 1 d/e" echo "100644 $o0 1 d/e"
echo "100644 $o1 3 d/e" echo "100644 $o1 3 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


' '


@ -480,7 +480,7 @@ test_expect_success 'reset and bind merge' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e" echo "100644 $o1 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual && test_cmp expected actual &&


git read-tree --prefix=a1/ master && git read-tree --prefix=a1/ master &&
git ls-files -s >actual && git ls-files -s >actual &&
@ -498,7 +498,7 @@ test_expect_success 'reset and bind merge' '
echo "100644 $o0 0 c" echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e" echo "100644 $o1 0 d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


git read-tree --prefix=z/ master && git read-tree --prefix=z/ master &&
git ls-files -s >actual && git ls-files -s >actual &&
@ -520,7 +520,7 @@ test_expect_success 'reset and bind merge' '
echo "100644 $o0 0 z/c" echo "100644 $o0 0 z/c"
echo "100644 $o1 0 z/d/e" echo "100644 $o1 0 z/d/e"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual


' '



4
t/t3040-subprojects-basic.sh

@ -24,7 +24,7 @@ test_expect_success 'create subprojects' \
git add sub2 && git add sub2 &&
git commit -q -m "subprojects added" && git commit -q -m "subprojects added" &&
git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current && git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
git diff expected current' test_cmp expected current'


git branch save HEAD git branch save HEAD


@ -62,7 +62,7 @@ test_expect_success 'check if clone works' \
'git ls-files -s >expected && 'git ls-files -s >expected &&
git clone -l -s . cloned && git clone -l -s . cloned &&
( cd cloned && git ls-files -s ) >current && ( cd cloned && git ls-files -s ) >current &&
git diff expected current' test_cmp expected current'


test_expect_success 'removing and adding subproject' \ test_expect_success 'removing and adding subproject' \
'git update-index --force-remove -- sub2 && 'git update-index --force-remove -- sub2 &&

2
t/t3100-ls-tree-restrict.sh

@ -35,7 +35,7 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
test_output () { test_output () {
sed -e "s/ $_x40 / X /" <current >check sed -e "s/ $_x40 / X /" <current >check
git diff expected check test_cmp expected check
} }


test_expect_success \ test_expect_success \

2
t/t3101-ls-tree-dirname.sh

@ -43,7 +43,7 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
test_output () { test_output () {
sed -e "s/ $_x40 / X /" <current >check sed -e "s/ $_x40 / X /" <current >check
git diff expected check test_cmp expected check
} }


test_expect_success \ test_expect_success \

30
t/t3300-funny-names.sh

@ -35,7 +35,7 @@ no-funny' >expected
test_expect_success 'git ls-files no-funny' \ test_expect_success 'git ls-files no-funny' \
'git update-index --add "$p0" "$p2" && 'git update-index --add "$p0" "$p2" &&
git ls-files >current && git ls-files >current &&
git diff expected current' test_cmp expected current'


t0=`git write-tree` t0=`git write-tree`
echo "$t0" >t0 echo "$t0" >t0
@ -48,14 +48,14 @@ EOF
test_expect_success 'git ls-files with-funny' \ test_expect_success 'git ls-files with-funny' \
'git update-index --add "$p1" && 'git update-index --add "$p1" &&
git ls-files >current && git ls-files >current &&
git diff expected current' test_cmp expected current'


echo 'just space echo 'just space
no-funny no-funny
tabs ," (dq) and spaces' >expected tabs ," (dq) and spaces' >expected
test_expect_success 'git ls-files -z with-funny' \ test_expect_success 'git ls-files -z with-funny' \
'git ls-files -z | perl -pe y/\\000/\\012/ >current && 'git ls-files -z | perl -pe y/\\000/\\012/ >current &&
git diff expected current' test_cmp expected current'


t1=`git write-tree` t1=`git write-tree`
echo "$t1" >t1 echo "$t1" >t1
@ -67,28 +67,28 @@ no-funny
EOF EOF
test_expect_success 'git ls-tree with funny' \ test_expect_success 'git ls-tree with funny' \
'git ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current && 'git ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
git diff expected current' test_cmp expected current'


cat > expected <<\EOF cat > expected <<\EOF
A "tabs\t,\" (dq) and spaces" A "tabs\t,\" (dq) and spaces"
EOF EOF
test_expect_success 'git diff-index with-funny' \ test_expect_success 'git diff-index with-funny' \
'git diff-index --name-status $t0 >current && 'git diff-index --name-status $t0 >current &&
git diff expected current' test_cmp expected current'


test_expect_success 'git diff-tree with-funny' \ test_expect_success 'git diff-tree with-funny' \
'git diff-tree --name-status $t0 $t1 >current && 'git diff-tree --name-status $t0 $t1 >current &&
git diff expected current' test_cmp expected current'


echo 'A echo 'A
tabs ," (dq) and spaces' >expected tabs ," (dq) and spaces' >expected
test_expect_success 'git diff-index -z with-funny' \ test_expect_success 'git diff-index -z with-funny' \
'git diff-index -z --name-status $t0 | perl -pe y/\\000/\\012/ >current && 'git diff-index -z --name-status $t0 | perl -pe y/\\000/\\012/ >current &&
git diff expected current' test_cmp expected current'


test_expect_success 'git diff-tree -z with-funny' \ test_expect_success 'git diff-tree -z with-funny' \
'git diff-tree -z --name-status $t0 $t1 | perl -pe y/\\000/\\012/ >current && 'git diff-tree -z --name-status $t0 $t1 | perl -pe y/\\000/\\012/ >current &&
git diff expected current' test_cmp expected current'


cat > expected <<\EOF cat > expected <<\EOF
CNUM no-funny "tabs\t,\" (dq) and spaces" CNUM no-funny "tabs\t,\" (dq) and spaces"
@ -96,7 +96,7 @@ EOF
test_expect_success 'git diff-tree -C with-funny' \ test_expect_success 'git diff-tree -C with-funny' \
'git diff-tree -C --find-copies-harder --name-status \ 'git diff-tree -C --find-copies-harder --name-status \
$t0 $t1 | sed -e 's/^C[0-9]*/CNUM/' >current && $t0 $t1 | sed -e 's/^C[0-9]*/CNUM/' >current &&
git diff expected current' test_cmp expected current'


cat > expected <<\EOF cat > expected <<\EOF
RNUM no-funny "tabs\t,\" (dq) and spaces" RNUM no-funny "tabs\t,\" (dq) and spaces"
@ -105,7 +105,7 @@ test_expect_success 'git diff-tree delete with-funny' \
'git update-index --force-remove "$p0" && 'git update-index --force-remove "$p0" &&
git diff-index -M --name-status \ git diff-index -M --name-status \
$t0 | sed -e 's/^R[0-9]*/RNUM/' >current && $t0 | sed -e 's/^R[0-9]*/RNUM/' >current &&
git diff expected current' test_cmp expected current'


cat > expected <<\EOF cat > expected <<\EOF
diff --git a/no-funny "b/tabs\t,\" (dq) and spaces" diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
@ -116,7 +116,7 @@ EOF
test_expect_success 'git diff-tree delete with-funny' \ test_expect_success 'git diff-tree delete with-funny' \
'git diff-index -M -p $t0 | 'git diff-index -M -p $t0 |
sed -e "s/index [0-9]*%/index NUM%/" >current && sed -e "s/index [0-9]*%/index NUM%/" >current &&
git diff expected current' test_cmp expected current'


chmod +x "$p1" chmod +x "$p1"
cat > expected <<\EOF cat > expected <<\EOF
@ -130,7 +130,7 @@ EOF
test_expect_success 'git diff-tree delete with-funny' \ test_expect_success 'git diff-tree delete with-funny' \
'git diff-index -M -p $t0 | 'git diff-index -M -p $t0 |
sed -e "s/index [0-9]*%/index NUM%/" >current && sed -e "s/index [0-9]*%/index NUM%/" >current &&
git diff expected current' test_cmp expected current'


cat >expected <<\EOF cat >expected <<\EOF
"tabs\t,\" (dq) and spaces" "tabs\t,\" (dq) and spaces"
@ -139,7 +139,7 @@ EOF
test_expect_success 'git diff-tree rename with-funny applied' \ test_expect_success 'git diff-tree rename with-funny applied' \
'git diff-index -M -p $t0 | 'git diff-index -M -p $t0 |
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
git diff expected current' test_cmp expected current'


cat > expected <<\EOF cat > expected <<\EOF
no-funny no-funny
@ -149,12 +149,12 @@ EOF
test_expect_success 'git diff-tree delete with-funny applied' \ test_expect_success 'git diff-tree delete with-funny applied' \
'git diff-index -p $t0 | 'git diff-index -p $t0 |
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
git diff expected current' test_cmp expected current'


test_expect_success 'git apply non-git diff' \ test_expect_success 'git apply non-git diff' \
'git diff-index -p $t0 | 'git diff-index -p $t0 |
sed -ne "/^[-+@]/p" | sed -ne "/^[-+@]/p" |
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
git diff expected current' test_cmp expected current'


test_done test_done

2
t/t3900-i18n-commit.sh

@ -9,7 +9,7 @@ test_description='commit and log output encodings'


compare_with () { compare_with () {
git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current && git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current &&
git diff current "$2" test_cmp current "$2"
} }


test_expect_success setup ' test_expect_success setup '

2
t/t4006-diff-mode.sh

@ -38,6 +38,6 @@ echo ":100644 100755 X X M rezrov" >expected


test_expect_success \ test_expect_success \
'verify' \ 'verify' \
'git diff expected check' 'test_cmp expected check'


test_done test_done

2
t/t4013-diff-various.sh

@ -112,7 +112,7 @@ do
} >"$actual" && } >"$actual" &&
if test -f "$expect" if test -f "$expect"
then then
git diff "$expect" "$actual" && test_cmp "$expect" "$actual" &&
rm -f "$actual" rm -f "$actual"
else else
# this is to help developing new tests. # this is to help developing new tests.

2
t/t4014-format-patch.sh

@ -226,7 +226,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '


git format-patch --cover-letter -2 && git format-patch --cover-letter -2 &&
sed -e "1,/A U Thor/d" -e "/^$/q" < 0000-cover-letter.patch > output && sed -e "1,/A U Thor/d" -e "/^$/q" < 0000-cover-letter.patch > output &&
git diff expect output test_cmp expect output


' '



12
t/t4015-diff-whitespace.sh

@ -43,13 +43,13 @@ index adf3937..6edc172 100644
EOF EOF


git diff > out git diff > out
test_expect_success "Ray's example without options" 'git diff expect out' test_expect_success "Ray's example without options" 'test_cmp expect out'


git diff -w > out git diff -w > out
test_expect_success "Ray's example with -w" 'git diff expect out' test_expect_success "Ray's example with -w" 'test_cmp expect out'


git diff -b > out git diff -b > out
test_expect_success "Ray's example with -b" 'git diff expect out' test_expect_success "Ray's example with -b" 'test_cmp expect out'


tr 'Q' '\015' << EOF > x tr 'Q' '\015' << EOF > x
whitespace at beginning whitespace at beginning
@ -90,14 +90,14 @@ index d99af23..8b32fb5 100644
+CR at end +CR at end
EOF EOF
git diff > out git diff > out
test_expect_success 'another test, without options' 'git diff expect out' test_expect_success 'another test, without options' 'test_cmp expect out'


cat << EOF > expect cat << EOF > expect
diff --git a/x b/x diff --git a/x b/x
index d99af23..8b32fb5 100644 index d99af23..8b32fb5 100644
EOF EOF
git diff -w > out git diff -w > out
test_expect_success 'another test, with -w' 'git diff expect out' test_expect_success 'another test, with -w' 'test_cmp expect out'


tr 'Q' '\015' << EOF > expect tr 'Q' '\015' << EOF > expect
diff --git a/x b/x diff --git a/x b/x
@ -115,7 +115,7 @@ index d99af23..8b32fb5 100644
CR at endQ CR at endQ
EOF EOF
git diff -b > out git diff -b > out
test_expect_success 'another test, with -b' 'git diff expect out' test_expect_success 'another test, with -b' 'test_cmp expect out'


test_expect_success 'check mixed spaces and tabs in indent' ' test_expect_success 'check mixed spaces and tabs in indent' '



4
t/t4016-diff-quote.sh

@ -49,7 +49,7 @@ cat >expect <<\EOF
EOF EOF
test_expect_success 'git diff --summary -M HEAD' ' test_expect_success 'git diff --summary -M HEAD' '
git diff --summary -M HEAD >actual && git diff --summary -M HEAD >actual &&
git diff expect actual test_cmp expect actual
' '


cat >expect <<\EOF cat >expect <<\EOF
@ -64,7 +64,7 @@ cat >expect <<\EOF
EOF EOF
test_expect_success 'git diff --stat -M HEAD' ' test_expect_success 'git diff --stat -M HEAD' '
git diff --stat -M HEAD >actual && git diff --stat -M HEAD >actual &&
git diff expect actual test_cmp expect actual
' '


test_done test_done

8
t/t4018-diff-funcname.sh

@ -33,13 +33,13 @@ EOF
sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java


test_expect_success 'default behaviour' ' test_expect_success 'default behaviour' '
git diff Beer.java Beer-correct.java | git diff --no-index Beer.java Beer-correct.java |
grep "^@@.*@@ public class Beer" grep "^@@.*@@ public class Beer"
' '


test_expect_success 'preset java pattern' ' test_expect_success 'preset java pattern' '
echo "*.java diff=java" >.gitattributes && echo "*.java diff=java" >.gitattributes &&
git diff Beer.java Beer-correct.java | git diff --no-index Beer.java Beer-correct.java |
grep "^@@.*@@ public static void main(" grep "^@@.*@@ public static void main("
' '


@ -48,13 +48,13 @@ git config diff.java.funcname '!static
[^ ].*s.*' [^ ].*s.*'


test_expect_success 'custom pattern' ' test_expect_success 'custom pattern' '
git diff Beer.java Beer-correct.java | git diff --no-index Beer.java Beer-correct.java |
grep "^@@.*@@ int special;$" grep "^@@.*@@ int special;$"
' '


test_expect_success 'last regexp must not be negated' ' test_expect_success 'last regexp must not be negated' '
git config diff.java.funcname "!static" && git config diff.java.funcname "!static" &&
! git diff Beer.java Beer-correct.java ! git diff --no-index Beer.java Beer-correct.java
' '


test_done test_done

14
t/t4100-apply-stat.sh

@ -11,36 +11,36 @@ test_description='git apply --stat --summary test.
test_expect_success \ test_expect_success \
'rename' \ 'rename' \
'git apply --stat --summary <../t4100/t-apply-1.patch >current && 'git apply --stat --summary <../t4100/t-apply-1.patch >current &&
git diff ../t4100/t-apply-1.expect current' test_cmp ../t4100/t-apply-1.expect current'


test_expect_success \ test_expect_success \
'copy' \ 'copy' \
'git apply --stat --summary <../t4100/t-apply-2.patch >current && 'git apply --stat --summary <../t4100/t-apply-2.patch >current &&
git diff ../t4100/t-apply-2.expect current' test_cmp ../t4100/t-apply-2.expect current'


test_expect_success \ test_expect_success \
'rewrite' \ 'rewrite' \
'git apply --stat --summary <../t4100/t-apply-3.patch >current && 'git apply --stat --summary <../t4100/t-apply-3.patch >current &&
git diff ../t4100/t-apply-3.expect current' test_cmp ../t4100/t-apply-3.expect current'


test_expect_success \ test_expect_success \
'mode' \ 'mode' \
'git apply --stat --summary <../t4100/t-apply-4.patch >current && 'git apply --stat --summary <../t4100/t-apply-4.patch >current &&
git diff ../t4100/t-apply-4.expect current' test_cmp ../t4100/t-apply-4.expect current'


test_expect_success \ test_expect_success \
'non git' \ 'non git' \
'git apply --stat --summary <../t4100/t-apply-5.patch >current && 'git apply --stat --summary <../t4100/t-apply-5.patch >current &&
git diff ../t4100/t-apply-5.expect current' test_cmp ../t4100/t-apply-5.expect current'


test_expect_success \ test_expect_success \
'non git' \ 'non git' \
'git apply --stat --summary <../t4100/t-apply-6.patch >current && 'git apply --stat --summary <../t4100/t-apply-6.patch >current &&
git diff ../t4100/t-apply-6.expect current' test_cmp ../t4100/t-apply-6.expect current'


test_expect_success \ test_expect_success \
'non git' \ 'non git' \
'git apply --stat --summary <../t4100/t-apply-7.patch >current && 'git apply --stat --summary <../t4100/t-apply-7.patch >current &&
git diff ../t4100/t-apply-7.expect current' test_cmp ../t4100/t-apply-7.expect current'


test_done test_done

4
t/t4104-apply-boundary.sh

@ -90,7 +90,7 @@ do
cat '"$kind-patch.$with"' cat '"$kind-patch.$with"'
(exit 1) (exit 1)
} && } &&
git diff '"$kind"'-expect victim test_cmp '"$kind"'-expect victim
' '
done done
done done
@ -108,7 +108,7 @@ do
cat '"$kind-ng.without"' cat '"$kind-ng.without"'
(exit 1) (exit 1)
} && } &&
git diff '"$kind"'-expect victim test_cmp '"$kind"'-expect victim
' '
done done



4
t/t4115-apply-symlink.sh

@ -33,7 +33,7 @@ test_expect_success 'apply symlink patch' '
git checkout side && git checkout side &&
git apply patch && git apply patch &&
git diff-files -p >patched && git diff-files -p >patched &&
git diff patch patched test_cmp patch patched


' '


@ -42,7 +42,7 @@ test_expect_success 'apply --index symlink patch' '
git checkout -f side && git checkout -f side &&
git apply --index patch && git apply --index patch &&
git diff-index --cached -p HEAD >patched && git diff-index --cached -p HEAD >patched &&
git diff patch patched test_cmp patch patched


' '



2
t/t4116-apply-reverse.sh

@ -42,7 +42,7 @@ test_expect_success 'apply in reverse' '
git reset --hard second && git reset --hard second &&
git apply --reverse --binary --index patch && git apply --reverse --binary --index patch &&
git diff >diff && git diff >diff &&
git diff /dev/null diff test_cmp /dev/null diff


' '



12
t/t4117-apply-reject.sh

@ -54,7 +54,7 @@ test_expect_success 'apply without --reject should fail' '
exit 1 exit 1
fi fi


git diff file1 saved.file1 test_cmp file1 saved.file1
' '


test_expect_success 'apply without --reject should fail' ' test_expect_success 'apply without --reject should fail' '
@ -65,7 +65,7 @@ test_expect_success 'apply without --reject should fail' '
exit 1 exit 1
fi fi


git diff file1 saved.file1 test_cmp file1 saved.file1
' '


test_expect_success 'apply with --reject should fail but update the file' ' test_expect_success 'apply with --reject should fail but update the file' '
@ -79,7 +79,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
exit 1 exit 1
fi fi


git diff file1 expected && test_cmp file1 expected &&


cat file1.rej && cat file1.rej &&


@ -105,7 +105,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
echo "file1 still exists?" echo "file1 still exists?"
exit 1 exit 1
} }
git diff file2 expected && test_cmp file2 expected &&


cat file2.rej && cat file2.rej &&


@ -132,7 +132,7 @@ test_expect_success 'the same test with --verbose' '
echo "file1 still exists?" echo "file1 still exists?"
exit 1 exit 1
} }
git diff file2 expected && test_cmp file2 expected &&


cat file2.rej && cat file2.rej &&


@ -151,7 +151,7 @@ test_expect_success 'apply cleanly with --verbose' '


git apply --verbose patch.1 && git apply --verbose patch.1 &&


git diff file1 clean test_cmp file1 clean
' '


test_done test_done

6
t/t4118-apply-empty-context.sh

@ -38,7 +38,7 @@ test_expect_success 'apply --numstat' '
echo "0 1 file1" && echo "0 1 file1" &&
echo "0 1 file2" echo "0 1 file2"
} >expect && } >expect &&
git diff expect actual test_cmp expect actual


' '


@ -48,8 +48,8 @@ test_expect_success 'apply --apply' '
cat file2.orig >file2 && cat file2.orig >file2 &&
git update-index file1 file2 && git update-index file1 file2 &&
git apply --index diff.output && git apply --index diff.output &&
git diff file1.mods file1 && test_cmp file1.mods file1 &&
git diff file2.mods file2 test_cmp file2.mods file2
' '


test_done test_done

6
t/t4200-rerere.sh

@ -101,7 +101,7 @@ cat > expect << EOF
EOF EOF
git rerere diff > out git rerere diff > out


test_expect_success 'rerere diff' 'git diff expect out' test_expect_success 'rerere diff' 'test_cmp expect out'


cat > expect << EOF cat > expect << EOF
a1 a1
@ -109,7 +109,7 @@ EOF


git rerere status > out git rerere status > out


test_expect_success 'rerere status' 'git diff expect out' test_expect_success 'rerere status' 'test_cmp expect out'


test_expect_success 'commit succeeds' \ test_expect_success 'commit succeeds' \
"git commit -q -a -m 'prefer first over second'" "git commit -q -a -m 'prefer first over second'"
@ -126,7 +126,7 @@ test_expect_success 'another conflicting merge' '
git show first:a1 | sed 's/To die: t/To die! T/' > expect git show first:a1 | sed 's/To die: t/To die! T/' > expect
test_expect_success 'rerere kicked in' "! grep ======= a1" test_expect_success 'rerere kicked in' "! grep ======= a1"


test_expect_success 'rerere prefers first change' 'git diff a1 expect' test_expect_success 'rerere prefers first change' 'test_cmp a1 expect'


rm $rr/postimage rm $rr/postimage
echo "$sha1 a1" | perl -pe 'y/\012/\000/' > .git/rr-cache/MERGE_RR echo "$sha1 a1" | perl -pe 'y/\012/\000/' > .git/rr-cache/MERGE_RR

4
t/t5305-include-tag.sh

@ -50,7 +50,7 @@ test_expect_success 'check unpacked result (have commit, no tag)' '
test_must_fail git cat-file -e $tag && test_must_fail git cat-file -e $tag &&
git rev-list --objects $commit git rev-list --objects $commit
) >list.actual && ) >list.actual &&
git diff list.expect list.actual test_cmp list.expect list.actual
' '


rm -rf clone.git rm -rf clone.git
@ -78,7 +78,7 @@ test_expect_success 'check unpacked result (have commit, have tag)' '
export GIT_DIR && export GIT_DIR &&
git rev-list --objects $tag git rev-list --objects $tag
) >list.actual && ) >list.actual &&
git diff list.expect list.actual test_cmp list.expect list.actual
' '


test_done test_done

2
t/t5400-send-pack.sh

@ -110,7 +110,7 @@ test_expect_success \
cd .. && cd .. &&
git update-ref refs/heads/master master^ || return 1 git update-ref refs/heads/master master^ || return 1
git-send-pack --force ./victim/.git/ master && return 1 git-send-pack --force ./victim/.git/ master && return 1
! git diff .git/refs/heads/master victim/.git/refs/heads/master ! test_cmp .git/refs/heads/master victim/.git/refs/heads/master
' '


test_expect_success \ test_expect_success \

10
t/t5401-update-hooks.sh

@ -83,23 +83,23 @@ test_expect_success 'hooks ran' '
test_expect_success 'pre-receive hook input' ' test_expect_success 'pre-receive hook input' '
(echo $commit0 $commit1 refs/heads/master; (echo $commit0 $commit1 refs/heads/master;
echo $commit1 $commit0 refs/heads/tofail echo $commit1 $commit0 refs/heads/tofail
) | git diff - victim/.git/pre-receive.stdin ) | test_cmp - victim/.git/pre-receive.stdin
' '


test_expect_success 'update hook arguments' ' test_expect_success 'update hook arguments' '
(echo refs/heads/master $commit0 $commit1; (echo refs/heads/master $commit0 $commit1;
echo refs/heads/tofail $commit1 $commit0 echo refs/heads/tofail $commit1 $commit0
) | git diff - victim/.git/update.args ) | test_cmp - victim/.git/update.args
' '


test_expect_success 'post-receive hook input' ' test_expect_success 'post-receive hook input' '
echo $commit0 $commit1 refs/heads/master | echo $commit0 $commit1 refs/heads/master |
git diff - victim/.git/post-receive.stdin test_cmp - victim/.git/post-receive.stdin
' '


test_expect_success 'post-update hook arguments' ' test_expect_success 'post-update hook arguments' '
echo refs/heads/master | echo refs/heads/master |
git diff - victim/.git/post-update.args test_cmp - victim/.git/post-update.args
' '


test_expect_success 'all hook stdin is /dev/null' ' test_expect_success 'all hook stdin is /dev/null' '
@ -130,7 +130,7 @@ STDERR post-update
EOF EOF
test_expect_success 'send-pack stderr contains hook messages' ' test_expect_success 'send-pack stderr contains hook messages' '
grep ^STD send.err >actual && grep ^STD send.err >actual &&
git diff - actual <expect test_cmp - actual <expect
' '


test_done test_done

8
t/t5503-tagfollow.sh

@ -50,7 +50,7 @@ test_expect_success 'fetch A (new commit : 1 connection)' '
) && ) &&
test -s $U && test -s $U &&
cut -d" " -f1,2 $U >actual && cut -d" " -f1,2 $U >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success "create tag T on A, create C on branch cat" ' test_expect_success "create tag T on A, create C on branch cat" '
@ -82,7 +82,7 @@ test_expect_success 'fetch C, T (new branch, tag : 1 connection)' '
) && ) &&
test -s $U && test -s $U &&
cut -d" " -f1,2 $U >actual && cut -d" " -f1,2 $U >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success "create commits O, B, tag S on B" ' test_expect_success "create commits O, B, tag S on B" '
@ -118,7 +118,7 @@ test_expect_success 'fetch B, S (commit and tag : 1 connection)' '
) && ) &&
test -s $U && test -s $U &&
cut -d" " -f1,2 $U >actual && cut -d" " -f1,2 $U >actual &&
git diff expect actual test_cmp expect actual
' '


cat - <<EOF >expect cat - <<EOF >expect
@ -144,7 +144,7 @@ test_expect_success 'new clone fetch master and tags' '
) && ) &&
test -s $U && test -s $U &&
cut -d" " -f1,2 $U >actual && cut -d" " -f1,2 $U >actual &&
git diff expect actual test_cmp expect actual
' '


test_done test_done

10
t/t5505-remote.sh

@ -135,7 +135,7 @@ test_expect_success 'show' '
git config --add remote.origin.push \ git config --add remote.origin.push \
+refs/tags/lastbackup && +refs/tags/lastbackup &&
git remote show origin > output && git remote show origin > output &&
git diff expect output) test_cmp expect output)
' '


test_expect_success 'prune' ' test_expect_success 'prune' '
@ -179,7 +179,7 @@ test_expect_success 'update' '
git remote add apis ../mirror && git remote add apis ../mirror &&
git remote update && git remote update &&
git branch -r > output && git branch -r > output &&
git diff expect output) test_cmp expect output)


' '


@ -206,7 +206,7 @@ test_expect_success 'update with arguments' '
git config remotes.titanus manduca && git config remotes.titanus manduca &&
git remote update phobaeticus titanus && git remote update phobaeticus titanus &&
git branch -r > output && git branch -r > output &&
git diff expect output) test_cmp expect output)


' '


@ -229,7 +229,7 @@ test_expect_success 'update default' '
git config remote.drosophila.skipDefaultUpdate true && git config remote.drosophila.skipDefaultUpdate true &&
git remote update default && git remote update default &&
git branch -r > output && git branch -r > output &&
git diff expect output) test_cmp expect output)


' '


@ -249,7 +249,7 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
git config remotes.default "$(printf "\t drosophila \n")" && git config remotes.default "$(printf "\t drosophila \n")" &&
git remote update default && git remote update default &&
git branch -r > output && git branch -r > output &&
git diff expect output) test_cmp expect output)


' '



4
t/t5515-fetch-merge-logic.sh

@ -151,7 +151,7 @@ do
git show-ref >"$actual_r" && git show-ref >"$actual_r" &&
if test -f "$expect_f" if test -f "$expect_f"
then then
git diff -u "$expect_f" "$actual_f" && test_cmp "$expect_f" "$actual_f" &&
rm -f "$actual_f" rm -f "$actual_f"
else else
# this is to help developing new tests. # this is to help developing new tests.
@ -160,7 +160,7 @@ do
fi && fi &&
if test -f "$expect_r" if test -f "$expect_r"
then then
git diff -u "$expect_r" "$actual_r" && test_cmp "$expect_r" "$actual_r" &&
rm -f "$actual_r" rm -f "$actual_r"
else else
# this is to help developing new tests. # this is to help developing new tests.

2
t/t6006-rev-list-format.sh

@ -15,7 +15,7 @@ test_format() {
cat >expect.$1 cat >expect.$1
test_expect_success "format $1" " test_expect_success "format $1" "
git rev-list --pretty=format:$2 master >output.$1 && git rev-list --pretty=format:$2 master >output.$1 &&
git diff expect.$1 output.$1 test_cmp expect.$1 output.$1
" "
} }



8
t/t6023-merge-file.sh

@ -63,7 +63,7 @@ test_expect_success "merge without conflict (missing LF at EOF)" \
"git merge-file test2.txt orig.txt new2.txt" "git merge-file test2.txt orig.txt new2.txt"


test_expect_success "merge result added missing LF" \ test_expect_success "merge result added missing LF" \
"git diff test.txt test2.txt" "test_cmp test.txt test2.txt"


cp test.txt backup.txt cp test.txt backup.txt
test_expect_success "merge with conflicts" \ test_expect_success "merge with conflicts" \
@ -86,7 +86,7 @@ non timebo mala, quoniam tu mecum es:
virga tua et baculus tuus ipsa me consolata sunt. virga tua et baculus tuus ipsa me consolata sunt.
EOF EOF


test_expect_success "expected conflict markers" "git diff test.txt expect.txt" test_expect_success "expected conflict markers" "test_cmp test.txt expect.txt"


cp backup.txt test.txt cp backup.txt test.txt
test_expect_success "merge with conflicts, using -L" \ test_expect_success "merge with conflicts, using -L" \
@ -110,7 +110,7 @@ virga tua et baculus tuus ipsa me consolata sunt.
EOF EOF


test_expect_success "expected conflict markers, with -L" \ test_expect_success "expected conflict markers, with -L" \
"git diff test.txt expect.txt" "test_cmp test.txt expect.txt"


sed "s/ tu / TU /" < new1.txt > new5.txt sed "s/ tu / TU /" < new1.txt > new5.txt
test_expect_success "conflict in removed tail" \ test_expect_success "conflict in removed tail" \
@ -132,7 +132,7 @@ virga tua et baculus tuus ipsa me consolata sunt.
>>>>>>> new5.txt >>>>>>> new5.txt
EOF EOF


test_expect_success "expected conflict markers" "git diff expect out" test_expect_success "expected conflict markers" "test_cmp expect out"


test_expect_success 'binary files cannot be merged' ' test_expect_success 'binary files cannot be merged' '
! git merge-file -p orig.txt ../test4012.png new1.txt 2> merge.err && ! git merge-file -p orig.txt ../test4012.png new1.txt 2> merge.err &&

4
t/t6024-recursive-merge.sh

@ -70,7 +70,7 @@ G
>>>>>>> G:a1 >>>>>>> G:a1
EOF EOF


test_expect_success "result contains a conflict" "git diff expect a1" test_expect_success "result contains a conflict" "test_cmp expect a1"


git ls-files --stage > out git ls-files --stage > out
cat > expect << EOF cat > expect << EOF
@ -79,7 +79,7 @@ cat > expect << EOF
100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1 100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1
EOF EOF


test_expect_success "virtual trees were processed" "git diff expect out" test_expect_success "virtual trees were processed" "test_cmp expect out"


test_expect_success 'refuse to merge binary files' ' test_expect_success 'refuse to merge binary files' '
git reset --hard && git reset --hard &&

4
t/t6029-merge-subtree.sh

@ -57,7 +57,7 @@ test_expect_success 'initial merge' '
echo "100644 $o1 0 git-gui/git-gui.sh" echo "100644 $o1 0 git-gui/git-gui.sh"
echo "100644 $o2 0 git.c" echo "100644 $o2 0 git.c"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual
' '


test_expect_success 'merge update' ' test_expect_success 'merge update' '
@ -73,7 +73,7 @@ test_expect_success 'merge update' '
echo "100644 $o3 0 git-gui/git-gui.sh" echo "100644 $o3 0 git-gui/git-gui.sh"
echo "100644 $o2 0 git.c" echo "100644 $o2 0 git.c"
) >expected && ) >expected &&
git diff -u expected actual test_cmp expected actual
' '


test_done test_done

2
t/t6120-describe.sh

@ -108,7 +108,7 @@ warning: tag 'A' is really 'Q' here
EOF EOF
check_describe A-* HEAD check_describe A-* HEAD
test_expect_success 'warning was displayed for Q' ' test_expect_success 'warning was displayed for Q' '
git diff err.expect err.actual test_cmp err.expect err.actual
' '
test_expect_success 'rename tag Q back to A' ' test_expect_success 'rename tag Q back to A' '
mv .git/refs/tags/Q .git/refs/tags/A mv .git/refs/tags/Q .git/refs/tags/A

16
t/t6200-fmt-merge-msg.sh

@ -79,7 +79,7 @@ test_expect_success 'merge-msg test #1' '
git fetch . left && git fetch . left &&


git fmt-merge-msg <.git/FETCH_HEAD >actual && git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected test_cmp expected actual
' '


cat >expected <<EOF cat >expected <<EOF
@ -92,7 +92,7 @@ test_expect_success 'merge-msg test #2' '
git fetch ../"$test" left && git fetch ../"$test" left &&


git fmt-merge-msg <.git/FETCH_HEAD >actual && git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected test_cmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
@ -117,7 +117,7 @@ test_expect_success 'merge-msg test #3-1' '
git fetch . left && git fetch . left &&


git fmt-merge-msg <.git/FETCH_HEAD >actual && git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected test_cmp expected actual
' '


test_expect_success 'merge-msg test #3-2' ' test_expect_success 'merge-msg test #3-2' '
@ -131,7 +131,7 @@ test_expect_success 'merge-msg test #3-2' '
git fetch . left && git fetch . left &&


git fmt-merge-msg <.git/FETCH_HEAD >actual && git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected test_cmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
@ -163,7 +163,7 @@ test_expect_success 'merge-msg test #4-1' '
git fetch . left right && git fetch . left right &&


git fmt-merge-msg <.git/FETCH_HEAD >actual && git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected test_cmp expected actual
' '


test_expect_success 'merge-msg test #4-2' ' test_expect_success 'merge-msg test #4-2' '
@ -177,7 +177,7 @@ test_expect_success 'merge-msg test #4-2' '
git fetch . left right && git fetch . left right &&


git fmt-merge-msg <.git/FETCH_HEAD >actual && git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected test_cmp expected actual
' '


test_expect_success 'merge-msg test #5-1' ' test_expect_success 'merge-msg test #5-1' '
@ -191,7 +191,7 @@ test_expect_success 'merge-msg test #5-1' '
git fetch . left right && git fetch . left right &&


git fmt-merge-msg <.git/FETCH_HEAD >actual && git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected test_cmp expected actual
' '


test_expect_success 'merge-msg test #5-2' ' test_expect_success 'merge-msg test #5-2' '
@ -205,7 +205,7 @@ test_expect_success 'merge-msg test #5-2' '
git fetch . left right && git fetch . left right &&


git fmt-merge-msg <.git/FETCH_HEAD >actual && git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected test_cmp expected actual
' '


test_done test_done

24
t/t6300-for-each-ref.sh

@ -75,14 +75,14 @@ EOF
test_expect_success 'Check unformatted date fields output' ' test_expect_success 'Check unformatted date fields output' '
(git for-each-ref --shell --format="%(refname) %(committerdate) %(authordate)" refs/heads && (git for-each-ref --shell --format="%(refname) %(committerdate) %(authordate)" refs/heads &&
git for-each-ref --shell --format="%(refname) %(taggerdate)" refs/tags) >actual && git for-each-ref --shell --format="%(refname) %(taggerdate)" refs/tags) >actual &&
git diff expected actual test_cmp expected actual
' '


test_expect_success 'Check format "default" formatted date fields output' ' test_expect_success 'Check format "default" formatted date fields output' '
f=default && f=default &&
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
git diff expected actual test_cmp expected actual
' '


# Don't know how to do relative check because I can't know when this script # Don't know how to do relative check because I can't know when this script
@ -109,7 +109,7 @@ test_expect_success 'Check format "short" date fields output' '
f=short && f=short &&
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
git diff expected actual test_cmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
@ -121,7 +121,7 @@ test_expect_success 'Check format "local" date fields output' '
f=local && f=local &&
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
git diff expected actual test_cmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
@ -133,7 +133,7 @@ test_expect_success 'Check format "iso8601" date fields output' '
f=iso8601 && f=iso8601 &&
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
git diff expected actual test_cmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
@ -145,7 +145,7 @@ test_expect_success 'Check format "rfc2822" date fields output' '
f=rfc2822 && f=rfc2822 &&
(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual &&
git diff expected actual test_cmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
@ -155,7 +155,7 @@ EOF


test_expect_success 'Verify ascending sort' ' test_expect_success 'Verify ascending sort' '
git-for-each-ref --format="%(refname)" --sort=refname >actual && git-for-each-ref --format="%(refname)" --sort=refname >actual &&
git diff expected actual test_cmp expected actual
' '




@ -166,7 +166,7 @@ EOF


test_expect_success 'Verify descending sort' ' test_expect_success 'Verify descending sort' '
git-for-each-ref --format="%(refname)" --sort=-refname >actual && git-for-each-ref --format="%(refname)" --sort=-refname >actual &&
git diff expected actual test_cmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
@ -176,17 +176,17 @@ EOF


test_expect_success 'Quoting style: shell' ' test_expect_success 'Quoting style: shell' '
git for-each-ref --shell --format="%(refname)" >actual && git for-each-ref --shell --format="%(refname)" >actual &&
git diff expected actual test_cmp expected actual
' '


test_expect_success 'Quoting style: perl' ' test_expect_success 'Quoting style: perl' '
git for-each-ref --perl --format="%(refname)" >actual && git for-each-ref --perl --format="%(refname)" >actual &&
git diff expected actual test_cmp expected actual
' '


test_expect_success 'Quoting style: python' ' test_expect_success 'Quoting style: python' '
git for-each-ref --python --format="%(refname)" >actual && git for-each-ref --python --format="%(refname)" >actual &&
git diff expected actual test_cmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
@ -196,7 +196,7 @@ EOF


test_expect_success 'Quoting style: tcl' ' test_expect_success 'Quoting style: tcl' '
git for-each-ref --tcl --format="%(refname)" >actual && git for-each-ref --tcl --format="%(refname)" >actual &&
git diff expected actual test_cmp expected actual
' '


for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do

4
t/t7003-filter-branch.sh

@ -224,7 +224,7 @@ test_expect_success 'Tag name filtering retains tag message' '
git cat-file tag T > expect && git cat-file tag T > expect &&
git filter-branch -f --tag-name-filter cat && git filter-branch -f --tag-name-filter cat &&
git cat-file tag T > actual && git cat-file tag T > actual &&
git diff expect actual test_cmp expect actual
' '


faux_gpg_tag='object XXXXXX faux_gpg_tag='object XXXXXX
@ -248,7 +248,7 @@ test_expect_success 'Tag name filtering strips gpg signature' '
echo "$faux_gpg_tag" | sed -e s/XXXXXX/$sha1/ | head -n 6 > expect && echo "$faux_gpg_tag" | sed -e s/XXXXXX/$sha1/ | head -n 6 > expect &&
git filter-branch -f --tag-name-filter cat && git filter-branch -f --tag-name-filter cat &&
git cat-file tag S > actual && git cat-file tag S > actual &&
git diff expect actual test_cmp expect actual
' '


test_done test_done

210
t/t7004-tag.sh

@ -116,9 +116,9 @@ mytag
EOF EOF
test_expect_success \ test_expect_success \
'trying to delete tags without params should succeed and do nothing' ' 'trying to delete tags without params should succeed and do nothing' '
git tag -l > actual && git diff expect actual && git tag -l > actual && test_cmp expect actual &&
git-tag -d && git-tag -d &&
git tag -l > actual && git diff expect actual git tag -l > actual && test_cmp expect actual
' '


test_expect_success \ test_expect_success \
@ -173,9 +173,9 @@ test_expect_success 'listing all tags should print them ordered' '
git tag v1.0 && git tag v1.0 &&
git tag t210 && git tag t210 &&
git tag -l > actual && git tag -l > actual &&
git diff expect actual && test_cmp expect actual &&
git tag > actual && git tag > actual &&
git diff expect actual test_cmp expect actual
' '


cat >expect <<EOF cat >expect <<EOF
@ -186,7 +186,7 @@ EOF
test_expect_success \ test_expect_success \
'listing tags with substring as pattern must print those matching' ' 'listing tags with substring as pattern must print those matching' '
git-tag -l "*a*" > actual && git-tag -l "*a*" > actual &&
git diff expect actual test_cmp expect actual
' '


cat >expect <<EOF cat >expect <<EOF
@ -196,7 +196,7 @@ EOF
test_expect_success \ test_expect_success \
'listing tags with a suffix as pattern must print those matching' ' 'listing tags with a suffix as pattern must print those matching' '
git-tag -l "*.1" > actual && git-tag -l "*.1" > actual &&
git diff expect actual test_cmp expect actual
' '


cat >expect <<EOF cat >expect <<EOF
@ -206,7 +206,7 @@ EOF
test_expect_success \ test_expect_success \
'listing tags with a prefix as pattern must print those matching' ' 'listing tags with a prefix as pattern must print those matching' '
git-tag -l "t21*" > actual && git-tag -l "t21*" > actual &&
git diff expect actual test_cmp expect actual
' '


cat >expect <<EOF cat >expect <<EOF
@ -215,7 +215,7 @@ EOF
test_expect_success \ test_expect_success \
'listing tags using a name as pattern must print that one matching' ' 'listing tags using a name as pattern must print that one matching' '
git-tag -l a1 > actual && git-tag -l a1 > actual &&
git diff expect actual test_cmp expect actual
' '


cat >expect <<EOF cat >expect <<EOF
@ -224,7 +224,7 @@ EOF
test_expect_success \ test_expect_success \
'listing tags using a name as pattern must print that one matching' ' 'listing tags using a name as pattern must print that one matching' '
git-tag -l v1.0 > actual && git-tag -l v1.0 > actual &&
git diff expect actual test_cmp expect actual
' '


cat >expect <<EOF cat >expect <<EOF
@ -234,14 +234,14 @@ EOF
test_expect_success \ test_expect_success \
'listing tags with ? in the pattern should print those matching' ' 'listing tags with ? in the pattern should print those matching' '
git-tag -l "v1.?.?" > actual && git-tag -l "v1.?.?" > actual &&
git diff expect actual test_cmp expect actual
' '


>expect >expect
test_expect_success \ test_expect_success \
'listing tags using v.* should print nothing because none have v.' ' 'listing tags using v.* should print nothing because none have v.' '
git-tag -l "v.*" > actual && git-tag -l "v.*" > actual &&
git diff expect actual test_cmp expect actual
' '


cat >expect <<EOF cat >expect <<EOF
@ -253,7 +253,7 @@ EOF
test_expect_success \ test_expect_success \
'listing tags using v* should print only those having v' ' 'listing tags using v* should print only those having v' '
git-tag -l "v*" > actual && git-tag -l "v*" > actual &&
git diff expect actual test_cmp expect actual
' '


# creating and verifying lightweight tags: # creating and verifying lightweight tags:
@ -302,7 +302,7 @@ test_expect_success \
'creating an annotated tag with -m message should succeed' ' 'creating an annotated tag with -m message should succeed' '
git-tag -m "A message" annotated-tag && git-tag -m "A message" annotated-tag &&
get_tag_msg annotated-tag >actual && get_tag_msg annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


cat >msgfile <<EOF cat >msgfile <<EOF
@ -315,7 +315,7 @@ test_expect_success \
'creating an annotated tag with -F messagefile should succeed' ' 'creating an annotated tag with -F messagefile should succeed' '
git-tag -F msgfile file-annotated-tag && git-tag -F msgfile file-annotated-tag &&
get_tag_msg file-annotated-tag >actual && get_tag_msg file-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


cat >inputmsg <<EOF cat >inputmsg <<EOF
@ -327,7 +327,7 @@ cat inputmsg >>expect
test_expect_success 'creating an annotated tag with -F - should succeed' ' test_expect_success 'creating an annotated tag with -F - should succeed' '
git-tag -F - stdin-annotated-tag <inputmsg && git-tag -F - stdin-annotated-tag <inputmsg &&
get_tag_msg stdin-annotated-tag >actual && get_tag_msg stdin-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
@ -358,7 +358,7 @@ test_expect_success \
'creating a tag with an empty -m message should succeed' ' 'creating a tag with an empty -m message should succeed' '
git-tag -m "" empty-annotated-tag && git-tag -m "" empty-annotated-tag &&
get_tag_msg empty-annotated-tag >actual && get_tag_msg empty-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


>emptyfile >emptyfile
@ -367,7 +367,7 @@ test_expect_success \
'creating a tag with an empty -F messagefile should succeed' ' 'creating a tag with an empty -F messagefile should succeed' '
git-tag -F emptyfile emptyfile-annotated-tag && git-tag -F emptyfile emptyfile-annotated-tag &&
get_tag_msg emptyfile-annotated-tag >actual && get_tag_msg emptyfile-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


printf '\n\n \n\t\nLeading blank lines\n' >blanksfile printf '\n\n \n\t\nLeading blank lines\n' >blanksfile
@ -388,7 +388,7 @@ test_expect_success \
'extra blanks in the message for an annotated tag should be removed' ' 'extra blanks in the message for an annotated tag should be removed' '
git-tag -F blanksfile blanks-annotated-tag && git-tag -F blanksfile blanks-annotated-tag &&
get_tag_msg blanks-annotated-tag >actual && get_tag_msg blanks-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


get_tag_header blank-annotated-tag $commit commit $time >expect get_tag_header blank-annotated-tag $commit commit $time >expect
@ -396,7 +396,7 @@ test_expect_success \
'creating a tag with blank -m message with spaces should succeed' ' 'creating a tag with blank -m message with spaces should succeed' '
git-tag -m " " blank-annotated-tag && git-tag -m " " blank-annotated-tag &&
get_tag_msg blank-annotated-tag >actual && get_tag_msg blank-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


echo ' ' >blankfile echo ' ' >blankfile
@ -407,7 +407,7 @@ test_expect_success \
'creating a tag with blank -F messagefile with spaces should succeed' ' 'creating a tag with blank -F messagefile with spaces should succeed' '
git-tag -F blankfile blankfile-annotated-tag && git-tag -F blankfile blankfile-annotated-tag &&
get_tag_msg blankfile-annotated-tag >actual && get_tag_msg blankfile-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


printf ' ' >blanknonlfile printf ' ' >blanknonlfile
@ -416,7 +416,7 @@ test_expect_success \
'creating a tag with -F file of spaces and no newline should succeed' ' 'creating a tag with -F file of spaces and no newline should succeed' '
git-tag -F blanknonlfile blanknonlfile-annotated-tag && git-tag -F blanknonlfile blanknonlfile-annotated-tag &&
get_tag_msg blanknonlfile-annotated-tag >actual && get_tag_msg blanknonlfile-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


# messages with commented lines: # messages with commented lines:
@ -451,7 +451,7 @@ test_expect_success \
'creating a tag using a -F messagefile with #comments should succeed' ' 'creating a tag using a -F messagefile with #comments should succeed' '
git-tag -F commentsfile comments-annotated-tag && git-tag -F commentsfile comments-annotated-tag &&
get_tag_msg comments-annotated-tag >actual && get_tag_msg comments-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


get_tag_header comment-annotated-tag $commit commit $time >expect get_tag_header comment-annotated-tag $commit commit $time >expect
@ -459,7 +459,7 @@ test_expect_success \
'creating a tag with a #comment in the -m message should succeed' ' 'creating a tag with a #comment in the -m message should succeed' '
git-tag -m "#comment" comment-annotated-tag && git-tag -m "#comment" comment-annotated-tag &&
get_tag_msg comment-annotated-tag >actual && get_tag_msg comment-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


echo '#comment' >commentfile echo '#comment' >commentfile
@ -470,7 +470,7 @@ test_expect_success \
'creating a tag with #comments in the -F messagefile should succeed' ' 'creating a tag with #comments in the -F messagefile should succeed' '
git-tag -F commentfile commentfile-annotated-tag && git-tag -F commentfile commentfile-annotated-tag &&
get_tag_msg commentfile-annotated-tag >actual && get_tag_msg commentfile-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


printf '#comment' >commentnonlfile printf '#comment' >commentnonlfile
@ -479,7 +479,7 @@ test_expect_success \
'creating a tag with a file of #comment and no newline should succeed' ' 'creating a tag with a file of #comment and no newline should succeed' '
git-tag -F commentnonlfile commentnonlfile-annotated-tag && git-tag -F commentnonlfile commentnonlfile-annotated-tag &&
get_tag_msg commentnonlfile-annotated-tag >actual && get_tag_msg commentnonlfile-annotated-tag >actual &&
git diff expect actual test_cmp expect actual
' '


# listing messages for annotated non-signed tags: # listing messages for annotated non-signed tags:
@ -490,23 +490,23 @@ test_expect_success \


echo "tag-one-line" >expect && echo "tag-one-line" >expect &&
git-tag -l | grep "^tag-one-line" >actual && git-tag -l | grep "^tag-one-line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^tag-one-line" >actual && git-tag -n0 -l | grep "^tag-one-line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l tag-one-line >actual && git-tag -n0 -l tag-one-line >actual &&
git diff expect actual && test_cmp expect actual &&


echo "tag-one-line A msg" >expect && echo "tag-one-line A msg" >expect &&
git-tag -n1 -l | grep "^tag-one-line" >actual && git-tag -n1 -l | grep "^tag-one-line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^tag-one-line" >actual && git-tag -n -l | grep "^tag-one-line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n1 -l tag-one-line >actual && git-tag -n1 -l tag-one-line >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n2 -l tag-one-line >actual && git-tag -n2 -l tag-one-line >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n999 -l tag-one-line >actual && git-tag -n999 -l tag-one-line >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
@ -515,23 +515,23 @@ test_expect_success \


echo "tag-zero-lines" >expect && echo "tag-zero-lines" >expect &&
git-tag -l | grep "^tag-zero-lines" >actual && git-tag -l | grep "^tag-zero-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^tag-zero-lines" >actual && git-tag -n0 -l | grep "^tag-zero-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l tag-zero-lines >actual && git-tag -n0 -l tag-zero-lines >actual &&
git diff expect actual && test_cmp expect actual &&


echo "tag-zero-lines " >expect && echo "tag-zero-lines " >expect &&
git-tag -n1 -l | grep "^tag-zero-lines" >actual && git-tag -n1 -l | grep "^tag-zero-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^tag-zero-lines" >actual && git-tag -n -l | grep "^tag-zero-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n1 -l tag-zero-lines >actual && git-tag -n1 -l tag-zero-lines >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n2 -l tag-zero-lines >actual && git-tag -n2 -l tag-zero-lines >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n999 -l tag-zero-lines >actual && git-tag -n999 -l tag-zero-lines >actual &&
git diff expect actual test_cmp expect actual
' '


echo 'tag line one' >annotagmsg echo 'tag line one' >annotagmsg
@ -543,39 +543,39 @@ test_expect_success \


echo "tag-lines" >expect && echo "tag-lines" >expect &&
git-tag -l | grep "^tag-lines" >actual && git-tag -l | grep "^tag-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^tag-lines" >actual && git-tag -n0 -l | grep "^tag-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l tag-lines >actual && git-tag -n0 -l tag-lines >actual &&
git diff expect actual && test_cmp expect actual &&


echo "tag-lines tag line one" >expect && echo "tag-lines tag line one" >expect &&
git-tag -n1 -l | grep "^tag-lines" >actual && git-tag -n1 -l | grep "^tag-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^tag-lines" >actual && git-tag -n -l | grep "^tag-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n1 -l tag-lines >actual && git-tag -n1 -l tag-lines >actual &&
git diff expect actual && test_cmp expect actual &&


echo " tag line two" >>expect && echo " tag line two" >>expect &&
git-tag -n2 -l | grep "^ *tag.line" >actual && git-tag -n2 -l | grep "^ *tag.line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n2 -l tag-lines >actual && git-tag -n2 -l tag-lines >actual &&
git diff expect actual && test_cmp expect actual &&


echo " tag line three" >>expect && echo " tag line three" >>expect &&
git-tag -n3 -l | grep "^ *tag.line" >actual && git-tag -n3 -l | grep "^ *tag.line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n3 -l tag-lines >actual && git-tag -n3 -l tag-lines >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n4 -l | grep "^ *tag.line" >actual && git-tag -n4 -l | grep "^ *tag.line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n4 -l tag-lines >actual && git-tag -n4 -l tag-lines >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n99 -l | grep "^ *tag.line" >actual && git-tag -n99 -l | grep "^ *tag.line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n99 -l tag-lines >actual && git-tag -n99 -l tag-lines >actual &&
git diff expect actual test_cmp expect actual
' '


# subsequent tests require gpg; check if it is available # subsequent tests require gpg; check if it is available
@ -635,7 +635,7 @@ echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success 'creating a signed tag with -m message should succeed' ' test_expect_success 'creating a signed tag with -m message should succeed' '
git-tag -s -m "A signed tag message" signed-tag && git-tag -s -m "A signed tag message" signed-tag &&
get_tag_msg signed-tag >actual && get_tag_msg signed-tag >actual &&
git diff expect actual test_cmp expect actual
' '


get_tag_header u-signed-tag $commit commit $time >expect get_tag_header u-signed-tag $commit commit $time >expect
@ -645,7 +645,7 @@ test_expect_success 'sign with a given key id' '


git tag -u committer@example.com -m "Another message" u-signed-tag && git tag -u committer@example.com -m "Another message" u-signed-tag &&
get_tag_msg u-signed-tag >actual && get_tag_msg u-signed-tag >actual &&
git diff expect actual test_cmp expect actual


' '


@ -675,7 +675,7 @@ echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success '-u implies signed tag' ' test_expect_success '-u implies signed tag' '
GIT_EDITOR=./fakeeditor git-tag -u CDDE430D implied-sign && GIT_EDITOR=./fakeeditor git-tag -u CDDE430D implied-sign &&
get_tag_msg implied-sign >actual && get_tag_msg implied-sign >actual &&
git diff expect actual test_cmp expect actual
' '


cat >sigmsgfile <<EOF cat >sigmsgfile <<EOF
@ -689,7 +689,7 @@ test_expect_success \
'creating a signed tag with -F messagefile should succeed' ' 'creating a signed tag with -F messagefile should succeed' '
git-tag -s -F sigmsgfile file-signed-tag && git-tag -s -F sigmsgfile file-signed-tag &&
get_tag_msg file-signed-tag >actual && get_tag_msg file-signed-tag >actual &&
git diff expect actual test_cmp expect actual
' '


cat >siginputmsg <<EOF cat >siginputmsg <<EOF
@ -702,7 +702,7 @@ echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success 'creating a signed tag with -F - should succeed' ' test_expect_success 'creating a signed tag with -F - should succeed' '
git-tag -s -F - stdin-signed-tag <siginputmsg && git-tag -s -F - stdin-signed-tag <siginputmsg &&
get_tag_msg stdin-signed-tag >actual && get_tag_msg stdin-signed-tag >actual &&
git diff expect actual test_cmp expect actual
' '


get_tag_header implied-annotate $commit commit $time >expect get_tag_header implied-annotate $commit commit $time >expect
@ -711,7 +711,7 @@ echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success '-s implies annotated tag' ' test_expect_success '-s implies annotated tag' '
GIT_EDITOR=./fakeeditor git-tag -s implied-annotate && GIT_EDITOR=./fakeeditor git-tag -s implied-annotate &&
get_tag_msg implied-annotate >actual && get_tag_msg implied-annotate >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
@ -752,7 +752,7 @@ test_expect_success \
'creating a signed tag with an empty -m message should succeed' ' 'creating a signed tag with an empty -m message should succeed' '
git-tag -s -m "" empty-signed-tag && git-tag -s -m "" empty-signed-tag &&
get_tag_msg empty-signed-tag >actual && get_tag_msg empty-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v empty-signed-tag git-tag -v empty-signed-tag
' '


@ -763,7 +763,7 @@ test_expect_success \
'creating a signed tag with an empty -F messagefile should succeed' ' 'creating a signed tag with an empty -F messagefile should succeed' '
git-tag -s -F sigemptyfile emptyfile-signed-tag && git-tag -s -F sigemptyfile emptyfile-signed-tag &&
get_tag_msg emptyfile-signed-tag >actual && get_tag_msg emptyfile-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v emptyfile-signed-tag git-tag -v emptyfile-signed-tag
' '


@ -786,7 +786,7 @@ test_expect_success \
'extra blanks in the message for a signed tag should be removed' ' 'extra blanks in the message for a signed tag should be removed' '
git-tag -s -F sigblanksfile blanks-signed-tag && git-tag -s -F sigblanksfile blanks-signed-tag &&
get_tag_msg blanks-signed-tag >actual && get_tag_msg blanks-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v blanks-signed-tag git-tag -v blanks-signed-tag
' '


@ -796,7 +796,7 @@ test_expect_success \
'creating a signed tag with a blank -m message should succeed' ' 'creating a signed tag with a blank -m message should succeed' '
git-tag -s -m " " blank-signed-tag && git-tag -s -m " " blank-signed-tag &&
get_tag_msg blank-signed-tag >actual && get_tag_msg blank-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v blank-signed-tag git-tag -v blank-signed-tag
' '


@ -809,7 +809,7 @@ test_expect_success \
'creating a signed tag with blank -F file with spaces should succeed' ' 'creating a signed tag with blank -F file with spaces should succeed' '
git-tag -s -F sigblankfile blankfile-signed-tag && git-tag -s -F sigblankfile blankfile-signed-tag &&
get_tag_msg blankfile-signed-tag >actual && get_tag_msg blankfile-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v blankfile-signed-tag git-tag -v blankfile-signed-tag
' '


@ -820,7 +820,7 @@ test_expect_success \
'creating a signed tag with spaces and no newline should succeed' ' 'creating a signed tag with spaces and no newline should succeed' '
git-tag -s -F sigblanknonlfile blanknonlfile-signed-tag && git-tag -s -F sigblanknonlfile blanknonlfile-signed-tag &&
get_tag_msg blanknonlfile-signed-tag >actual && get_tag_msg blanknonlfile-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v signed-tag git-tag -v signed-tag
' '


@ -857,7 +857,7 @@ test_expect_success \
'creating a signed tag with a -F file with #comments should succeed' ' 'creating a signed tag with a -F file with #comments should succeed' '
git-tag -s -F sigcommentsfile comments-signed-tag && git-tag -s -F sigcommentsfile comments-signed-tag &&
get_tag_msg comments-signed-tag >actual && get_tag_msg comments-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v comments-signed-tag git-tag -v comments-signed-tag
' '


@ -867,7 +867,7 @@ test_expect_success \
'creating a signed tag with #commented -m message should succeed' ' 'creating a signed tag with #commented -m message should succeed' '
git-tag -s -m "#comment" comment-signed-tag && git-tag -s -m "#comment" comment-signed-tag &&
get_tag_msg comment-signed-tag >actual && get_tag_msg comment-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v comment-signed-tag git-tag -v comment-signed-tag
' '


@ -880,7 +880,7 @@ test_expect_success \
'creating a signed tag with #commented -F messagefile should succeed' ' 'creating a signed tag with #commented -F messagefile should succeed' '
git-tag -s -F sigcommentfile commentfile-signed-tag && git-tag -s -F sigcommentfile commentfile-signed-tag &&
get_tag_msg commentfile-signed-tag >actual && get_tag_msg commentfile-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v commentfile-signed-tag git-tag -v commentfile-signed-tag
' '


@ -891,7 +891,7 @@ test_expect_success \
'creating a signed tag with a #comment and no newline should succeed' ' 'creating a signed tag with a #comment and no newline should succeed' '
git-tag -s -F sigcommentnonlfile commentnonlfile-signed-tag && git-tag -s -F sigcommentnonlfile commentnonlfile-signed-tag &&
get_tag_msg commentnonlfile-signed-tag >actual && get_tag_msg commentnonlfile-signed-tag >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -v commentnonlfile-signed-tag git-tag -v commentnonlfile-signed-tag
' '


@ -903,23 +903,23 @@ test_expect_success \


echo "stag-one-line" >expect && echo "stag-one-line" >expect &&
git-tag -l | grep "^stag-one-line" >actual && git-tag -l | grep "^stag-one-line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^stag-one-line" >actual && git-tag -n0 -l | grep "^stag-one-line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l stag-one-line >actual && git-tag -n0 -l stag-one-line >actual &&
git diff expect actual && test_cmp expect actual &&


echo "stag-one-line A message line signed" >expect && echo "stag-one-line A message line signed" >expect &&
git-tag -n1 -l | grep "^stag-one-line" >actual && git-tag -n1 -l | grep "^stag-one-line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^stag-one-line" >actual && git-tag -n -l | grep "^stag-one-line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n1 -l stag-one-line >actual && git-tag -n1 -l stag-one-line >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n2 -l stag-one-line >actual && git-tag -n2 -l stag-one-line >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n999 -l stag-one-line >actual && git-tag -n999 -l stag-one-line >actual &&
git diff expect actual test_cmp expect actual
' '


test_expect_success \ test_expect_success \
@ -928,23 +928,23 @@ test_expect_success \


echo "stag-zero-lines" >expect && echo "stag-zero-lines" >expect &&
git-tag -l | grep "^stag-zero-lines" >actual && git-tag -l | grep "^stag-zero-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^stag-zero-lines" >actual && git-tag -n0 -l | grep "^stag-zero-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l stag-zero-lines >actual && git-tag -n0 -l stag-zero-lines >actual &&
git diff expect actual && test_cmp expect actual &&


echo "stag-zero-lines " >expect && echo "stag-zero-lines " >expect &&
git-tag -n1 -l | grep "^stag-zero-lines" >actual && git-tag -n1 -l | grep "^stag-zero-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^stag-zero-lines" >actual && git-tag -n -l | grep "^stag-zero-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n1 -l stag-zero-lines >actual && git-tag -n1 -l stag-zero-lines >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n2 -l stag-zero-lines >actual && git-tag -n2 -l stag-zero-lines >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n999 -l stag-zero-lines >actual && git-tag -n999 -l stag-zero-lines >actual &&
git diff expect actual test_cmp expect actual
' '


echo 'stag line one' >sigtagmsg echo 'stag line one' >sigtagmsg
@ -956,39 +956,39 @@ test_expect_success \


echo "stag-lines" >expect && echo "stag-lines" >expect &&
git-tag -l | grep "^stag-lines" >actual && git-tag -l | grep "^stag-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^stag-lines" >actual && git-tag -n0 -l | grep "^stag-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n0 -l stag-lines >actual && git-tag -n0 -l stag-lines >actual &&
git diff expect actual && test_cmp expect actual &&


echo "stag-lines stag line one" >expect && echo "stag-lines stag line one" >expect &&
git-tag -n1 -l | grep "^stag-lines" >actual && git-tag -n1 -l | grep "^stag-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^stag-lines" >actual && git-tag -n -l | grep "^stag-lines" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n1 -l stag-lines >actual && git-tag -n1 -l stag-lines >actual &&
git diff expect actual && test_cmp expect actual &&


echo " stag line two" >>expect && echo " stag line two" >>expect &&
git-tag -n2 -l | grep "^ *stag.line" >actual && git-tag -n2 -l | grep "^ *stag.line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n2 -l stag-lines >actual && git-tag -n2 -l stag-lines >actual &&
git diff expect actual && test_cmp expect actual &&


echo " stag line three" >>expect && echo " stag line three" >>expect &&
git-tag -n3 -l | grep "^ *stag.line" >actual && git-tag -n3 -l | grep "^ *stag.line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n3 -l stag-lines >actual && git-tag -n3 -l stag-lines >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n4 -l | grep "^ *stag.line" >actual && git-tag -n4 -l | grep "^ *stag.line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n4 -l stag-lines >actual && git-tag -n4 -l stag-lines >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n99 -l | grep "^ *stag.line" >actual && git-tag -n99 -l | grep "^ *stag.line" >actual &&
git diff expect actual && test_cmp expect actual &&
git-tag -n99 -l stag-lines >actual && git-tag -n99 -l stag-lines >actual &&
git diff expect actual test_cmp expect actual
' '


# tags pointing to objects different from commits: # tags pointing to objects different from commits:
@ -1004,7 +1004,7 @@ test_expect_success \
'creating a signed tag pointing to a tree should succeed' ' 'creating a signed tag pointing to a tree should succeed' '
git-tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} && git-tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} &&
get_tag_msg tree-signed-tag >actual && get_tag_msg tree-signed-tag >actual &&
git diff expect actual test_cmp expect actual
' '


get_tag_header blob-signed-tag $blob blob $time >expect get_tag_header blob-signed-tag $blob blob $time >expect
@ -1014,7 +1014,7 @@ test_expect_success \
'creating a signed tag pointing to a blob should succeed' ' 'creating a signed tag pointing to a blob should succeed' '
git-tag -s -m "A message for a blob" blob-signed-tag HEAD:foo && git-tag -s -m "A message for a blob" blob-signed-tag HEAD:foo &&
get_tag_msg blob-signed-tag >actual && get_tag_msg blob-signed-tag >actual &&
git diff expect actual test_cmp expect actual
' '


get_tag_header tag-signed-tag $tag tag $time >expect get_tag_header tag-signed-tag $tag tag $time >expect
@ -1024,7 +1024,7 @@ test_expect_success \
'creating a signed tag pointing to another tag should succeed' ' 'creating a signed tag pointing to another tag should succeed' '
git-tag -s -m "A message for another tag" tag-signed-tag signed-tag && git-tag -s -m "A message for another tag" tag-signed-tag signed-tag &&
get_tag_msg tag-signed-tag >actual && get_tag_msg tag-signed-tag >actual &&
git diff expect actual test_cmp expect actual
' '


# try to sign with bad user.signingkey # try to sign with bad user.signingkey
@ -1064,7 +1064,7 @@ test_expect_success \
git tag -a -m "An annotation to be reused" reuse && git tag -a -m "An annotation to be reused" reuse &&
GIT_EDITOR=true git tag -f -a reuse && GIT_EDITOR=true git tag -f -a reuse &&
get_tag_msg reuse >actual && get_tag_msg reuse >actual &&
git diff expect actual test_cmp expect actual
' '


test_done test_done

12
t/t7102-reset.sh

@ -34,13 +34,13 @@ test_expect_success 'creating initial files and commits' '


check_changes () { check_changes () {
test "$(git rev-parse HEAD)" = "$1" && test "$(git rev-parse HEAD)" = "$1" &&
git diff | git diff .diff_expect - && git diff | test_cmp .diff_expect - &&
git diff --cached | git diff .cached_expect - && git diff --cached | test_cmp .cached_expect - &&
for FILE in * for FILE in *
do do
echo $FILE':' echo $FILE':'
cat $FILE || return cat $FILE || return
done | git diff .cat_expect - done | test_cmp .cat_expect -
} }


>.diff_expect >.diff_expect
@ -390,9 +390,9 @@ test_expect_success 'test --mixed <paths>' '
git add file1 file3 file4 && git add file1 file3 file4 &&
! git reset HEAD -- file1 file2 file3 && ! git reset HEAD -- file1 file2 file3 &&
git diff > output && git diff > output &&
git diff output expect && test_cmp output expect &&
git diff --cached > output && git diff --cached > output &&
git diff output cached_expect test_cmp output cached_expect
' '


test_expect_success 'test resetting the index at give paths' ' test_expect_success 'test resetting the index at give paths' '
@ -425,7 +425,7 @@ EOF
test_expect_success '--mixed refreshes the index' ' test_expect_success '--mixed refreshes the index' '
echo 123 >> file2 && echo 123 >> file2 &&
git reset --mixed HEAD > output && git reset --mixed HEAD > output &&
git diff --exit-code expect output test_cmp expect output
' '


test_done test_done

6
t/t7502-status.sh

@ -63,7 +63,7 @@ EOF
test_expect_success 'status (2)' ' test_expect_success 'status (2)' '


git status > output && git status > output &&
git diff expect output test_cmp expect output


' '


@ -93,7 +93,7 @@ EOF
test_expect_success 'status with relative paths' ' test_expect_success 'status with relative paths' '


(cd dir1 && git status) > output && (cd dir1 && git status) > output &&
git diff expect output test_cmp expect output


' '


@ -124,7 +124,7 @@ test_expect_success 'status without relative paths' '


git config status.relativePaths false git config status.relativePaths false
(cd dir1 && git status) > output && (cd dir1 && git status) > output &&
git diff expect output test_cmp expect output


' '



6
t/t9100-git-svn-basic.sh

@ -169,7 +169,7 @@ test_expect_success "$name" '
svn up "$SVN_TREE" && svn up "$SVN_TREE" &&
test -f "$SVN_TREE"/exec-2.sh && test -f "$SVN_TREE"/exec-2.sh &&
test ! -L "$SVN_TREE"/exec-2.sh && test ! -L "$SVN_TREE"/exec-2.sh &&
git diff help "$SVN_TREE"/exec-2.sh' test_cmp help "$SVN_TREE"/exec-2.sh'


if test "$have_utf8" = t if test "$have_utf8" = t
then then
@ -193,7 +193,7 @@ test_expect_success "$name" \
'git-svn init "$svnrepo" && git-svn fetch && 'git-svn init "$svnrepo" && git-svn fetch &&
git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a && git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b && git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
git diff a b' test_cmp a b'


name='check imported tree checksums expected tree checksums' name='check imported tree checksums expected tree checksums'
rm -f expected rm -f expected
@ -211,7 +211,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4 tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
EOF EOF


test_expect_success "$name" "git diff a expected" test_expect_success "$name" "test_cmp a expected"


test_expect_success 'exit if remote refs are ambigious' " test_expect_success 'exit if remote refs are ambigious' "
git config --add svn-remote.svn.fetch \ git config --add svn-remote.svn.fetch \

34
t/t9300-fast-import.sh

@ -74,7 +74,7 @@ EOF
test_expect_success \ test_expect_success \
'A: verify commit' \ 'A: verify commit' \
'git cat-file commit master | sed 1d >actual && 'git cat-file commit master | sed 1d >actual &&
git diff expect actual' test_cmp expect actual'


cat >expect <<EOF cat >expect <<EOF
100644 blob file2 100644 blob file2
@ -84,22 +84,22 @@ EOF
test_expect_success \ test_expect_success \
'A: verify tree' \ 'A: verify tree' \
'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual && 'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
git diff expect actual' test_cmp expect actual'


echo "$file2_data" >expect echo "$file2_data" >expect
test_expect_success \ test_expect_success \
'A: verify file2' \ 'A: verify file2' \
'git cat-file blob master:file2 >actual && git diff expect actual' 'git cat-file blob master:file2 >actual && test_cmp expect actual'


echo "$file3_data" >expect echo "$file3_data" >expect
test_expect_success \ test_expect_success \
'A: verify file3' \ 'A: verify file3' \
'git cat-file blob master:file3 >actual && git diff expect actual' 'git cat-file blob master:file3 >actual && test_cmp expect actual'


printf "$file4_data" >expect printf "$file4_data" >expect
test_expect_success \ test_expect_success \
'A: verify file4' \ 'A: verify file4' \
'git cat-file blob master:file4 >actual && git diff expect actual' 'git cat-file blob master:file4 >actual && test_cmp expect actual'


cat >expect <<EOF cat >expect <<EOF
:2 `git rev-parse --verify master:file2` :2 `git rev-parse --verify master:file2`
@ -109,7 +109,7 @@ cat >expect <<EOF
EOF EOF
test_expect_success \ test_expect_success \
'A: verify marks output' \ 'A: verify marks output' \
'git diff expect marks.out' 'test_cmp expect marks.out'


test_expect_success \ test_expect_success \
'A: verify marks import' \ 'A: verify marks import' \
@ -117,7 +117,7 @@ test_expect_success \
--import-marks=marks.out \ --import-marks=marks.out \
--export-marks=marks.new \ --export-marks=marks.new \
</dev/null && </dev/null &&
git diff -u expect marks.new' test_cmp expect marks.new'


test_tick test_tick
cat >input <<INPUT_END cat >input <<INPUT_END
@ -259,7 +259,7 @@ EOF
test_expect_success \ test_expect_success \
'C: verify commit' \ 'C: verify commit' \
'git cat-file commit branch | sed 1d >actual && 'git cat-file commit branch | sed 1d >actual &&
git diff expect actual' test_cmp expect actual'


cat >expect <<EOF cat >expect <<EOF
:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
@ -316,13 +316,13 @@ echo "$file5_data" >expect
test_expect_success \ test_expect_success \
'D: verify file5' \ 'D: verify file5' \
'git cat-file blob branch:newdir/interesting >actual && 'git cat-file blob branch:newdir/interesting >actual &&
git diff expect actual' test_cmp expect actual'


echo "$file6_data" >expect echo "$file6_data" >expect
test_expect_success \ test_expect_success \
'D: verify file6' \ 'D: verify file6' \
'git cat-file blob branch:newdir/exec.sh >actual && 'git cat-file blob branch:newdir/exec.sh >actual &&
git diff expect actual' test_cmp expect actual'


### ###
### series E ### series E
@ -358,7 +358,7 @@ EOF
test_expect_success \ test_expect_success \
'E: verify commit' \ 'E: verify commit' \
'git cat-file commit branch | sed 1,2d >actual && 'git cat-file commit branch | sed 1,2d >actual &&
git diff expect actual' test_cmp expect actual'


### ###
### series F ### series F
@ -411,7 +411,7 @@ EOF
test_expect_success \ test_expect_success \
'F: verify other commit' \ 'F: verify other commit' \
'git cat-file commit other >actual && 'git cat-file commit other >actual &&
git diff expect actual' test_cmp expect actual'


### ###
### series G ### series G
@ -489,7 +489,7 @@ echo "$file5_data" >expect
test_expect_success \ test_expect_success \
'H: verify file' \ 'H: verify file' \
'git cat-file blob H:h/e/l/lo >actual && 'git cat-file blob H:h/e/l/lo >actual &&
git diff expect actual' test_cmp expect actual'


### ###
### series I ### series I
@ -515,7 +515,7 @@ EOF
test_expect_success \ test_expect_success \
'I: verify edge list' \ 'I: verify edge list' \
'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual && 'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
git diff expect actual' test_cmp expect actual'


### ###
### series J ### series J
@ -625,7 +625,7 @@ test_expect_success \
'L: verify internal tree sorting' \ 'L: verify internal tree sorting' \
'git-fast-import <input && 'git-fast-import <input &&
git diff-tree --abbrev --raw L^ L >output && git diff-tree --abbrev --raw L^ L >output &&
git diff expect output' test_cmp expect output'


### ###
### series M ### series M
@ -885,7 +885,7 @@ test_expect_success \
test 8 = `find .git/objects/pack -type f | wc -l` && test 8 = `find .git/objects/pack -type f | wc -l` &&
test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` && test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual && git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
git diff expect actual' test_cmp expect actual'


cat >input <<INPUT_END cat >input <<INPUT_END
commit refs/heads/O4 commit refs/heads/O4
@ -916,6 +916,6 @@ test_expect_success \
'O: progress outputs as requested by input' \ 'O: progress outputs as requested by input' \
'git-fast-import <input >actual && 'git-fast-import <input >actual &&
grep "progress " <input >expect && grep "progress " <input >expect &&
git diff expect actual' test_cmp expect actual'


test_done test_done

8
t/t9600-cvsimport.sh

@ -69,7 +69,7 @@ EOF
test_expect_success 'import a trivial module' ' test_expect_success 'import a trivial module' '


git cvsimport -a -z 0 -C module-git module && git cvsimport -a -z 0 -C module-git module &&
git diff module-cvs/o_fortuna module-git/o_fortuna test_cmp module-cvs/o_fortuna module-git/o_fortuna


' '


@ -110,7 +110,7 @@ test_expect_success 'update git module' '
git cvsimport -a -z 0 module && git cvsimport -a -z 0 module &&
git merge origin && git merge origin &&
cd .. && cd .. &&
git diff module-cvs/o_fortuna module-git/o_fortuna test_cmp module-cvs/o_fortuna module-git/o_fortuna


' '


@ -131,7 +131,7 @@ test_expect_success 'cvsimport.module config works' '
git cvsimport -a -z0 && git cvsimport -a -z0 &&
git merge origin && git merge origin &&
cd .. && cd .. &&
git diff module-cvs/tick module-git/tick test_cmp module-cvs/tick module-git/tick


' '


@ -142,7 +142,7 @@ test_expect_success 'import from a CVS working tree' '
git cvsimport -a -z0 && git cvsimport -a -z0 &&
echo 1 >expect && echo 1 >expect &&
git log -1 --pretty=format:%s%n >actual && git log -1 --pretty=format:%s%n >actual &&
git diff actual expect && test_cmp actual expect &&
cd .. cd ..


' '

Loading…
Cancel
Save