Browse Source

Merge branch 'jk/portable'

* jk/portable:
  t6000lib: re-fix tr portability
  t7505: use SHELL_PATH in hook
  t9112: add missing #!/bin/sh header
  filter-branch: use $SHELL_PATH instead of 'sh'
  filter-branch: don't use xargs -0
  add NO_EXTERNAL_GREP build option
  t6000lib: tr portability fix
  t4020: don't use grep -a
  add test_cmp function for test scripts
  remove use of "tail -n 1" and "tail -1"
  grep portability fix: don't use "-e" or "-q"
  more tr portability test script fixes
  t0050: perl portability fix
  tr portability fixes
maint
Junio C Hamano 17 years ago
parent
commit
1f17868b30
  1. 7
      Makefile
  2. 12
      builtin-grep.c
  3. 2
      git-am.sh
  4. 4
      git-bisect.sh
  5. 8
      git-filter-branch.sh
  6. 8
      git-rebase--interactive.sh
  7. 6
      git-submodule.sh
  8. 4
      t/diff-lib.sh
  9. 2
      t/t0003-attributes.sh
  10. 2
      t/t0020-crlf.sh
  11. 2
      t/t0022-crlf-rename.sh
  12. 34
      t/t0030-stripspace.sh
  13. 4
      t/t0050-filesystem.sh
  14. 2
      t/t1005-read-tree-reset.sh
  15. 4
      t/t1300-repo-config.sh
  16. 2
      t/t2200-add-update.sh
  17. 2
      t/t3001-ls-files-others-exclude.sh
  18. 4
      t/t3050-subprojects-fetch.sh
  19. 2
      t/t3060-ls-files-with-tree.sh
  20. 6
      t/t3201-branch-contains.sh
  21. 6
      t/t3300-funny-names.sh
  22. 11
      t/t3404-rebase-interactive.sh
  23. 4
      t/t3405-rebase-malformed.sh
  24. 2
      t/t3406-rebase-message.sh
  25. 4
      t/t3701-add-interactive.sh
  26. 2
      t/t3800-mktag.sh
  27. 16
      t/t3902-quoted.sh
  28. 2
      t/t3903-stash.sh
  29. 5
      t/t4020-diff-external.sh
  30. BIN
      t/t4020/diff.NUL
  31. 5
      t/t4022-diff-rewrite.sh
  32. 6
      t/t4023-diff-rename-typechange.sh
  33. 2
      t/t4024-diff-optimize-common.sh
  34. 2
      t/t4025-hunk-header.sh
  35. 6
      t/t4027-diff-submodule.sh
  36. 4
      t/t4103-apply-binary.sh
  37. 2
      t/t4105-apply-fuzz.sh
  38. 4
      t/t4116-apply-reverse.sh
  39. 8
      t/t4125-apply-ws-fuzz.sh
  40. 10
      t/t4150-am-subdir.sh
  41. 2
      t/t4200-rerere.sh
  42. 2
      t/t4201-shortlog.sh
  43. 2
      t/t5300-pack-object.sh
  44. 4
      t/t5302-pack-index.sh
  45. 2
      t/t5400-send-pack.sh
  46. 6
      t/t5505-remote.sh
  47. 2
      t/t5510-fetch.sh
  48. 8
      t/t5512-ls-remote.sh
  49. 8
      t/t6000lib.sh
  50. 2
      t/t6004-rev-list-path-optim.sh
  51. 2
      t/t6009-rev-list-parent.sh
  52. 4
      t/t6027-merge-binary.sh
  53. 2
      t/t6029-merge-subtree.sh
  54. 6
      t/t6030-bisect-porcelain.sh
  55. 2
      t/t7003-filter-branch.sh
  56. 18
      t/t7010-setup.sh
  57. 18
      t/t7201-co.sh
  58. 14
      t/t7501-commit.sh
  59. 14
      t/t7502-commit.sh
  60. 4
      t/t7502-status.sh
  61. 5
      t/t7505-prepare-commit-msg-hook.sh
  62. 8
      t/t7600-merge.sh
  63. 4
      t/t8003-blame.sh
  64. 2
      t/t9001-send-email.sh
  65. 2
      t/t9112-git-svn-md5less-file.sh
  66. 24
      t/t9116-git-svn-log.sh
  67. 14
      t/t9200-git-cvsexportcommit.sh
  68. 28
      t/t9400-git-cvsserver-server.sh
  69. 18
      t/test-lib.sh
  70. 4
      test-sha1.sh

7
Makefile

@ -148,6 +148,9 @@ all:: @@ -148,6 +148,9 @@ all::
# is a simplified version of the merge sort used in glibc. This is
# recommended if Git triggers O(n^2) behavior in your platform's qsort().
#
# Define NO_EXTERNAL_GREP if you don't want "git grep" to ever call
# your external grep (e.g., if your system lacks grep, if its grep is
# broken, or spawning external process is slower than built-in grep git has).

GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@ -760,6 +763,9 @@ endif @@ -760,6 +763,9 @@ endif
ifdef DIR_HAS_BSD_GROUP_SEMANTICS
COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
endif
ifdef NO_EXTERNAL_GREP
BASIC_CFLAGS += -DNO_EXTERNAL_GREP
endif

ifeq ($(TCLTK_PATH),)
NO_TCLTK=NoThanks
@ -867,6 +873,7 @@ common-cmds.h: $(wildcard Documentation/git-*.txt) @@ -867,6 +873,7 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
$(QUIET_GEN)$(RM) $@ $@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \

12
builtin-grep.c

@ -12,6 +12,14 @@ @@ -12,6 +12,14 @@
#include "builtin.h"
#include "grep.h"

#ifndef NO_EXTERNAL_GREP
#ifdef __unix__
#define NO_EXTERNAL_GREP 0
#else
#define NO_EXTERNAL_GREP 1
#endif
#endif

/*
* git grep pathspecs are somewhat different from diff-tree pathspecs;
* pathname wildcards are allowed.
@ -153,7 +161,7 @@ static int grep_file(struct grep_opt *opt, const char *filename) @@ -153,7 +161,7 @@ static int grep_file(struct grep_opt *opt, const char *filename)
return i;
}

#ifdef __unix__
#if !NO_EXTERNAL_GREP
static int exec_grep(int argc, const char **argv)
{
pid_t pid;
@ -372,7 +380,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached) @@ -372,7 +380,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
int nr;
read_cache();

#ifdef __unix__
#if !NO_EXTERNAL_GREP
/*
* Use the external "grep" command for the case where
* we grep through the checked-out files. It tends to

2
git-am.sh

@ -357,7 +357,7 @@ do @@ -357,7 +357,7 @@ do
LAST_SIGNED_OFF_BY=`
sed -ne '/^Signed-off-by: /p' \
"$dotest/msg-clean" |
tail -n 1
sed -ne '$p'
`
ADD_SIGNOFF=`
test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {

4
git-bisect.sh

@ -293,14 +293,14 @@ bisect_next() { @@ -293,14 +293,14 @@ bisect_next() {
bisect_next_check good

skip=$(git for-each-ref --format='%(objectname)' \
"refs/bisect/skip-*" | tr '[\012]' ' ') || exit
"refs/bisect/skip-*" | tr '\012' ' ') || exit

BISECT_OPT=''
test -n "$skip" && BISECT_OPT='--bisect-all'

bad=$(git rev-parse --verify refs/bisect/bad) &&
good=$(git for-each-ref --format='^%(objectname)' \
"refs/bisect/good-*" | tr '[\012]' ' ') &&
"refs/bisect/good-*" | tr '\012' ' ') &&
eval="git rev-list --bisect-vars $BISECT_OPT $good $bad --" &&
eval="$eval $(cat "$GIT_DIR/BISECT_NAMES")" &&
eval=$(filter_skipped "$eval" "$skip") &&

8
git-filter-branch.sh

@ -58,8 +58,8 @@ eval "$functions" @@ -58,8 +58,8 @@ eval "$functions"
# "author" or "committer

set_ident () {
lid="$(echo "$1" | tr "A-Z" "a-z")"
uid="$(echo "$1" | tr "a-z" "A-Z")"
lid="$(echo "$1" | tr "[A-Z]" "[a-z]")"
uid="$(echo "$1" | tr "[a-z]" "[A-Z]")"
pick_id_script='
/^'$lid' /{
s/'\''/'\''\\'\'\''/g
@ -281,7 +281,7 @@ while read commit parents; do @@ -281,7 +281,7 @@ while read commit parents; do
die "Could not checkout the index"
# files that $commit removed are now still in the working tree;
# remove them, else they would be added again
git ls-files -z --others | xargs -0 rm -f
git clean -q -f -x
eval "$filter_tree" < /dev/null ||
die "tree filter failed: $filter_tree"

@ -309,7 +309,7 @@ while read commit parents; do @@ -309,7 +309,7 @@ while read commit parents; do
sed -e '1,/^$/d' <../commit | \
eval "$filter_msg" > ../message ||
die "msg filter failed: $filter_msg"
sh -c "$filter_commit" "git commit-tree" \
@SHELL_PATH@ -c "$filter_commit" "git commit-tree" \
$(git write-tree) $parentstr < ../message > ../map/$commit
done <../revs


8
git-rebase--interactive.sh

@ -78,8 +78,8 @@ mark_action_done () { @@ -78,8 +78,8 @@ mark_action_done () {
sed -e 1q < "$TODO" >> "$DONE"
sed -e 1d < "$TODO" >> "$TODO".new
mv -f "$TODO".new "$TODO"
count=$(($(grep -ve '^$' -e '^#' < "$DONE" | wc -l)))
total=$(($count+$(grep -ve '^$' -e '^#' < "$TODO" | wc -l)))
count=$(grep -c '^[^#]' < "$DONE")
total=$(($count+$(grep -c '^[^#]' < "$TODO")))
if test "$last_count" != "$count"
then
last_count=$count
@ -110,7 +110,7 @@ die_abort () { @@ -110,7 +110,7 @@ die_abort () {
}

has_action () {
grep -vqe '^$' -e '^#' "$1"
grep '^[^#]' "$1" >/dev/null
}

pick_one () {
@ -218,7 +218,7 @@ nth_string () { @@ -218,7 +218,7 @@ nth_string () {
make_squash_message () {
if test -f "$SQUASH_MSG"; then
COUNT=$(($(sed -n "s/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p" \
< "$SQUASH_MSG" | tail -n 1)+1))
< "$SQUASH_MSG" | sed -ne '$p')+1))
echo "# This is a combination of $COUNT commits."
sed -e 1d -e '2,/^./{
/^$/d

6
git-submodule.sh

@ -232,7 +232,7 @@ cmd_init() @@ -232,7 +232,7 @@ cmd_init()
shift
done

git ls-files --stage -- "$@" | grep -e '^160000 ' |
git ls-files --stage -- "$@" | grep '^160000 ' |
while read mode sha1 stage path
do
# Skip already registered paths
@ -286,7 +286,7 @@ cmd_update() @@ -286,7 +286,7 @@ cmd_update()
shift
done

git ls-files --stage -- "$@" | grep -e '^160000 ' |
git ls-files --stage -- "$@" | grep '^160000 ' |
while read mode sha1 stage path
do
name=$(module_name "$path") || exit
@ -537,7 +537,7 @@ cmd_status() @@ -537,7 +537,7 @@ cmd_status()
shift
done

git ls-files --stage -- "$@" | grep -e '^160000 ' |
git ls-files --stage -- "$@" | grep '^160000 ' |
while read mode sha1 stage path
do
name=$(module_name "$path") || exit

4
t/diff-lib.sh

@ -21,8 +21,8 @@ compare_diff_raw_z () { @@ -21,8 +21,8 @@ compare_diff_raw_z () {
# Also we do not check SHA1 hash generation in this test, which
# is a job for t0000-basic.sh

tr '\000' '\012' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
tr '\000' '\012' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
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
git diff .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
}


2
t/t0003-attributes.sh

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

git check-attr test -- "$path" >actual &&
echo "$path: test: $2" >expect &&
diff -u expect actual
test_cmp expect actual

}


2
t/t0020-crlf.sh

@ -5,7 +5,7 @@ test_description='CRLF conversion' @@ -5,7 +5,7 @@ test_description='CRLF conversion'
. ./test-lib.sh

q_to_nul () {
tr Q '\000'
perl -pe 'y/Q/\000/'
}

q_to_cr () {

2
t/t0022-crlf-rename.sh

@ -26,7 +26,7 @@ test_expect_success 'diff -M' ' @@ -26,7 +26,7 @@ test_expect_success 'diff -M' '
git diff-tree -M -r --name-status HEAD^ HEAD |
sed -e "s/R[0-9]*/RNUM/" >actual &&
echo "RNUM sample elpmas" >expect &&
diff -u expect actual
test_cmp expect actual

'


34
t/t0030-stripspace.sh

@ -245,12 +245,12 @@ test_expect_success \ @@ -245,12 +245,12 @@ test_expect_success \

test_expect_success \
'text plus spaces without newline at end should not show spaces' '
! (printf "$ttt$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$sss$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
! (printf "$ttt$sss" | git stripspace | grep " " >/dev/null) &&
! (printf "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&
! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&
! (printf "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&
! (printf "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&
! (printf "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null)
'

test_expect_success \
@ -282,12 +282,12 @@ test_expect_success \ @@ -282,12 +282,12 @@ test_expect_success \

test_expect_success \
'text plus spaces at end should not show spaces' '
! (echo "$ttt$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$sss$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
! (echo "$ttt$sss" | git stripspace | grep " " >/dev/null) &&
! (echo "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&
! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&
! (echo "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&
! (echo "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&
! (echo "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null)
'

test_expect_success \
@ -341,11 +341,11 @@ test_expect_success \ @@ -341,11 +341,11 @@ test_expect_success \

test_expect_success \
'spaces without newline at end should not show spaces' '
! (printf "" | git stripspace | grep -q " ") &&
! (printf "$sss" | git stripspace | grep -q " ") &&
! (printf "$sss$sss" | git stripspace | grep -q " ") &&
! (printf "$sss$sss$sss" | git stripspace | grep -q " ") &&
! (printf "$sss$sss$sss$sss" | git stripspace | grep -q " ")
! (printf "" | git stripspace | grep " " >/dev/null) &&
! (printf "$sss" | git stripspace | grep " " >/dev/null) &&
! (printf "$sss$sss" | git stripspace | grep " " >/dev/null) &&
! (printf "$sss$sss$sss" | git stripspace | grep " " >/dev/null) &&
! (printf "$sss$sss$sss$sss" | git stripspace | grep " " >/dev/null)
'

test_expect_success \

4
t/t0050-filesystem.sh

@ -4,8 +4,8 @@ test_description='Various filesystem issues' @@ -4,8 +4,8 @@ test_description='Various filesystem issues'

. ./test-lib.sh

auml=`perl -CO -e 'print pack("U",0x00E4)'`
aumlcdiar=`perl -CO -e 'print pack("U",0x0061).pack("U",0x0308)'`
auml=`printf '\xc3\xa4'`
aumlcdiar=`printf '\x61\xcc\x88'`

test_expect_success 'see if we expect ' '


2
t/t1005-read-tree-reset.sh

@ -24,7 +24,7 @@ test_expect_success 'setup' ' @@ -24,7 +24,7 @@ test_expect_success 'setup' '
test_expect_success 'reset should work' '
git read-tree -u --reset HEAD^ &&
git ls-files >actual &&
diff -u expect actual
test_cmp expect actual
'

test_done

4
t/t1300-repo-config.sh

@ -657,12 +657,12 @@ Qsection.sub=section.val4 @@ -657,12 +657,12 @@ Qsection.sub=section.val4
Qsection.sub=section.val5Q
EOF

git config --null --list | tr '\000' 'Q' > result
git config --null --list | perl -pe 'y/\000/Q/' > result
echo >>result

test_expect_success '--null --list' 'cmp result expect'

git config --null --get-regexp 'val[0-9]' | tr '\000' 'Q' > result
git config --null --get-regexp 'val[0-9]' | perl -pe 'y/\000/Q/' > result
echo >>result

test_expect_success '--null --get-regexp' 'cmp result expect'

2
t/t2200-add-update.sh

@ -62,7 +62,7 @@ test_expect_success 'cache tree has not been corrupted' ' @@ -62,7 +62,7 @@ test_expect_success 'cache tree has not been corrupted' '
sed -e "s/ 0 / /" >expect &&
git ls-tree -r $(git write-tree) |
sed -e "s/ blob / /" >current &&
diff -u expect current
test_cmp expect current

'


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

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

test_expect_success 'git-status honours core.excludesfile' \
'diff -u expect output'
'test_cmp expect output'

test_expect_success 'trailing slash in exclude allows directory match(1)' '


4
t/t3050-subprojects-fetch.sh

@ -26,7 +26,7 @@ test_expect_success clone ' @@ -26,7 +26,7 @@ test_expect_success clone '
cd cloned &&
(git rev-parse HEAD; git ls-files -s) >../actual
) &&
diff -u expected actual
test_cmp expected actual
'

test_expect_success advance '
@ -46,7 +46,7 @@ test_expect_success fetch ' @@ -46,7 +46,7 @@ test_expect_success fetch '
git pull &&
(git rev-parse HEAD; git ls-files -s) >../actual
) &&
diff -u expected actual
test_cmp expected actual
'

test_done

2
t/t3060-ls-files-with-tree.sh

@ -66,6 +66,6 @@ test_expect_success 'git -ls-files --with-tree should succeed from subdir' ' @@ -66,6 +66,6 @@ test_expect_success 'git -ls-files --with-tree should succeed from subdir' '
cd ..
test_expect_success \
'git -ls-files --with-tree should add entries from named tree.' \
'diff -u expected output'
'test_cmp expected output'

test_done

6
t/t3201-branch-contains.sh

@ -31,7 +31,7 @@ test_expect_success 'branch --contains=master' ' @@ -31,7 +31,7 @@ test_expect_success 'branch --contains=master' '
{
echo " master" && echo "* side"
} >expect &&
diff -u expect actual
test_cmp expect actual

'

@ -41,7 +41,7 @@ test_expect_success 'branch --contains master' ' @@ -41,7 +41,7 @@ test_expect_success 'branch --contains master' '
{
echo " master" && echo "* side"
} >expect &&
diff -u expect actual
test_cmp expect actual

'

@ -51,7 +51,7 @@ test_expect_success 'branch --contains=side' ' @@ -51,7 +51,7 @@ test_expect_success 'branch --contains=side' '
{
echo "* side"
} >expect &&
diff -u expect actual
test_cmp expect actual

'


6
t/t3300-funny-names.sh

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

t1=`git write-tree`
@ -83,11 +83,11 @@ test_expect_success 'git diff-tree with-funny' \ @@ -83,11 +83,11 @@ test_expect_success 'git diff-tree with-funny' \
echo 'A
tabs ," (dq) and spaces' >expected
test_expect_success 'git diff-index -z with-funny' \
'git diff-index -z --name-status $t0 | tr \\000 \\012 >current &&
'git diff-index -z --name-status $t0 | perl -pe y/\\000/\\012/ >current &&
git diff expected current'

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

cat > expected <<\EOF

11
t/t3404-rebase-interactive.sh

@ -122,8 +122,8 @@ test_expect_success 'reflog for the branch shows state before rebase' ' @@ -122,8 +122,8 @@ test_expect_success 'reflog for the branch shows state before rebase' '

test_expect_success 'exchange two commits' '
FAKE_LINES="2 1" git rebase -i HEAD~2 &&
test H = $(git cat-file commit HEAD^ | tail -n 1) &&
test G = $(git cat-file commit HEAD | tail -n 1)
test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
test G = $(git cat-file commit HEAD | sed -ne \$p)
'

cat > expect << EOF
@ -146,11 +146,10 @@ EOF @@ -146,11 +146,10 @@ EOF
test_expect_success 'stop on conflicting pick' '
git tag new-branch1 &&
! git rebase -i master &&
diff -u expect .git/.dotest-merge/patch &&
diff -u expect2 file1 &&
test_cmp expect .git/.dotest-merge/patch &&
test_cmp expect2 file1 &&
test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) &&
test 0 = $(grep -ve "^#" -e "^$" < .git/.dotest-merge/git-rebase-todo |
wc -l)
test 0 = $(grep -c "^[^#]" < .git/.dotest-merge/git-rebase-todo)
'

test_expect_success 'abort' '

4
t/t3405-rebase-malformed.sh

@ -41,8 +41,8 @@ test_expect_success rebase ' @@ -41,8 +41,8 @@ test_expect_success rebase '
git rebase master side &&
git cat-file commit HEAD | sed -e "1,/^\$/d" >F1 &&

diff -u F0 F1 &&
diff -u F F0
test_cmp F0 F1 &&
test_cmp F F0
'

test_done

2
t/t3406-rebase-message.sh

@ -37,7 +37,7 @@ test_expect_success 'rebase -m' ' @@ -37,7 +37,7 @@ test_expect_success 'rebase -m' '
git rebase -m master >report &&
sed -n -e "/^Already applied: /p" \
-e "/^Committed: /p" report >actual &&
diff -u expect actual
test_cmp expect actual

'


4
t/t3701-add-interactive.sh

@ -24,7 +24,7 @@ EOF @@ -24,7 +24,7 @@ EOF
test_expect_success 'diff works (initial)' '
(echo d; echo 1) | git add -i >output &&
sed -ne "/new file/,/content/p" <output >diff &&
diff -u expected diff
test_cmp expected diff
'
test_expect_success 'revert works (initial)' '
git add file &&
@ -57,7 +57,7 @@ EOF @@ -57,7 +57,7 @@ EOF
test_expect_success 'diff works (commit)' '
(echo d; echo 1) | git add -i >output &&
sed -ne "/^index/,/content/p" <output >diff &&
diff -u expected diff
test_cmp expected diff
'
test_expect_success 'revert works (commit)' '
git add file &&

2
t/t3800-mktag.sh

@ -15,7 +15,7 @@ check_verify_failure () { @@ -15,7 +15,7 @@ check_verify_failure () {
expect="$2"
test_expect_success "$1" '
( ! git-mktag <tag.sig 2>message ) &&
grep -q "$expect" message
grep "$expect" message
'
}


16
t/t3902-quoted.sh

@ -78,28 +78,28 @@ EOF @@ -78,28 +78,28 @@ EOF

test_expect_success 'check fully quoted output from ls-files' '

git ls-files >current && diff -u expect.quoted current
git ls-files >current && test_cmp expect.quoted current

'

test_expect_success 'check fully quoted output from diff-files' '

git diff --name-only >current &&
diff -u expect.quoted current
test_cmp expect.quoted current

'

test_expect_success 'check fully quoted output from diff-index' '

git diff --name-only HEAD >current &&
diff -u expect.quoted current
test_cmp expect.quoted current

'

test_expect_success 'check fully quoted output from diff-tree' '

git diff --name-only HEAD^ HEAD >current &&
diff -u expect.quoted current
test_cmp expect.quoted current

'

@ -111,28 +111,28 @@ test_expect_success 'setting core.quotepath' ' @@ -111,28 +111,28 @@ test_expect_success 'setting core.quotepath' '

test_expect_success 'check fully quoted output from ls-files' '

git ls-files >current && diff -u expect.raw current
git ls-files >current && test_cmp expect.raw current

'

test_expect_success 'check fully quoted output from diff-files' '

git diff --name-only >current &&
diff -u expect.raw current
test_cmp expect.raw current

'

test_expect_success 'check fully quoted output from diff-index' '

git diff --name-only HEAD >current &&
diff -u expect.raw current
test_cmp expect.raw current

'

test_expect_success 'check fully quoted output from diff-tree' '

git diff --name-only HEAD^ HEAD >current &&
diff -u expect.raw current
test_cmp expect.raw current

'


2
t/t3903-stash.sh

@ -34,7 +34,7 @@ EOF @@ -34,7 +34,7 @@ EOF
test_expect_success 'parents of stash' '
test $(git rev-parse stash^) = $(git rev-parse HEAD) &&
git diff stash^2..stash > output &&
diff -u output expect
test_cmp output expect
'

test_expect_success 'apply needs clean working directory' '

5
t/t4020-diff-external.sh

@ -99,11 +99,12 @@ test_expect_success 'no diff with -diff' ' @@ -99,11 +99,12 @@ test_expect_success 'no diff with -diff' '
git diff | grep Binary
'

echo NULZbetweenZwords | tr Z '\000' > file
echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file

test_expect_success 'force diff with "diff"' '
echo >.gitattributes "file diff" &&
git diff | grep -a second
git diff >actual &&
test_cmp ../t4020/diff.NUL actual
'

test_done

BIN
t/t4020/diff.NUL

Binary file not shown.

5
t/t4022-diff-rewrite.sh

@ -8,7 +8,10 @@ test_expect_success setup ' @@ -8,7 +8,10 @@ test_expect_success setup '

cat ../../COPYING >test &&
git add test &&
tr 'a-zA-Z' 'n-za-mN-ZA-M' <../../COPYING >test
tr \
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
"nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
<../../COPYING >test

'


6
t/t4023-diff-rename-typechange.sh

@ -57,7 +57,7 @@ test_expect_success 'cross renames to be detected for regular files' ' @@ -57,7 +57,7 @@ test_expect_success 'cross renames to be detected for regular files' '
echo "R100 foo bar"
echo "R100 bar foo"
} | sort >expect &&
diff -u expect actual
test_cmp expect actual

'

@ -68,7 +68,7 @@ test_expect_success 'cross renames to be detected for typechange' ' @@ -68,7 +68,7 @@ test_expect_success 'cross renames to be detected for typechange' '
echo "R100 foo bar"
echo "R100 bar foo"
} | sort >expect &&
diff -u expect actual
test_cmp expect actual

'

@ -79,7 +79,7 @@ test_expect_success 'moves and renames' ' @@ -79,7 +79,7 @@ test_expect_success 'moves and renames' '
echo "R100 foo bar"
echo "T100 foo"
} | sort >expect &&
diff -u expect actual
test_cmp expect actual

'


2
t/t4024-diff-optimize-common.sh

@ -150,7 +150,7 @@ test_expect_success 'diff -U0' ' @@ -150,7 +150,7 @@ test_expect_success 'diff -U0' '
do
git diff -U0 file-?$n
done | zc >actual &&
diff -u expect actual
test_cmp expect actual

'


2
t/t4025-hunk-header.sh

@ -37,7 +37,7 @@ test_expect_success 'hunk header truncation with an overly long line' ' @@ -37,7 +37,7 @@ test_expect_success 'hunk header truncation with an overly long line' '
echo " A $N$N$N$N$N$N$N$N$N2"
echo " L $N$N$N$N$N$N$N$N$N1"
) >expected &&
diff -u actual expected
test_cmp actual expected

'


6
t/t4027-diff-submodule.sh

@ -37,17 +37,17 @@ test_expect_success setup ' @@ -37,17 +37,17 @@ test_expect_success setup '

test_expect_success 'git diff --raw HEAD' '
git diff --raw --abbrev=40 HEAD >actual &&
diff -u expect actual
test_cmp expect actual
'

test_expect_success 'git diff-index --raw HEAD' '
git diff-index --raw HEAD >actual.index &&
diff -u expect actual.index
test_cmp expect actual.index
'

test_expect_success 'git diff-files --raw' '
git diff-files --raw >actual.files &&
diff -u expect actual.files
test_cmp expect actual.files
'

test_done

4
t/t4103-apply-binary.sh

@ -24,10 +24,10 @@ git update-index --add --remove file1 file2 file4 @@ -24,10 +24,10 @@ git update-index --add --remove file1 file2 file4
git-commit -m 'Initial Version' 2>/dev/null

git-checkout -b binary
tr 'x' '\000' <file1 >file3
perl -pe 'y/x/\000/' <file1 >file3
cat file3 >file4
git add file2
tr '\000' 'v' <file3 >file1
perl -pe 'y/\000/v/' <file3 >file1
rm -f file2
git update-index --add --remove file1 file2 file3 file4
git-commit -m 'Second Version'

2
t/t4105-apply-fuzz.sh

@ -9,7 +9,7 @@ dotest () { @@ -9,7 +9,7 @@ dotest () {
test_expect_success "$name" "
git checkout-index -f -q -u file &&
git apply $* &&
diff -u expect file
test_cmp expect file
"
}


4
t/t4116-apply-reverse.sh

@ -12,14 +12,14 @@ test_description='git apply in reverse @@ -12,14 +12,14 @@ test_description='git apply in reverse
test_expect_success setup '

for i in a b c d e f g h i j k l m n; do echo $i; done >file1 &&
tr "ijk" '\''\000\001\002'\'' <file1 >file2 &&
perl -pe "y/ijk/\\000\\001\\002/" <file1 >file2 &&

git add file1 file2 &&
git commit -m initial &&
git tag initial &&

for i in a b c g h i J K L m o n p q; do echo $i; done >file1 &&
tr "mon" '\''\000\001\002'\'' <file1 >file2 &&
perl -pe "y/mon/\\000\\001\\002/" <file1 >file2 &&

git commit -a -m second &&
git tag second &&

8
t/t4125-apply-ws-fuzz.sh

@ -56,7 +56,7 @@ test_expect_success nofix ' @@ -56,7 +56,7 @@ test_expect_success nofix '
git apply --whitespace=nowarn patch-1 &&

# The result should obviously match.
diff -u file-1 file
test_cmp file-1 file
'

test_expect_success 'withfix (forward)' '
@ -70,7 +70,7 @@ test_expect_success 'withfix (forward)' ' @@ -70,7 +70,7 @@ test_expect_success 'withfix (forward)' '
git apply --whitespace=fix patch-0 &&
git apply --whitespace=fix patch-1 &&

diff -u file-fixed file
test_cmp file-fixed file
'

test_expect_success 'withfix (backward)' '
@ -91,12 +91,12 @@ test_expect_success 'withfix (backward)' ' @@ -91,12 +91,12 @@ test_expect_success 'withfix (backward)' '

sed -e /h/d file-fixed >fixed-head &&
sed -e /h/d file >file-head &&
diff -u fixed-head file-head &&
test_cmp fixed-head file-head &&

sed -n -e /h/p file-fixed >fixed-tail &&
sed -n -e /h/p file >file-tail &&

! diff -u fixed-tail file-tail
! test_cmp fixed-tail file-tail

'


10
t/t4150-am-subdir.sh

@ -22,14 +22,14 @@ test_expect_success 'am regularly from stdin' ' @@ -22,14 +22,14 @@ test_expect_success 'am regularly from stdin' '
git checkout initial &&
git am <patchfile &&
git diff master >actual &&
diff -u expect actual
test_cmp expect actual
'

test_expect_success 'am regularly from file' '
git checkout initial &&
git am patchfile &&
git diff master >actual &&
diff -u expect actual
test_cmp expect actual
'

test_expect_success 'am regularly from stdin in subdirectory' '
@ -41,7 +41,7 @@ test_expect_success 'am regularly from stdin in subdirectory' ' @@ -41,7 +41,7 @@ test_expect_success 'am regularly from stdin in subdirectory' '
git am <../patchfile
) &&
git diff master>actual &&
diff -u expect actual
test_cmp expect actual
'

test_expect_success 'am regularly from file in subdirectory' '
@ -53,7 +53,7 @@ test_expect_success 'am regularly from file in subdirectory' ' @@ -53,7 +53,7 @@ test_expect_success 'am regularly from file in subdirectory' '
git am ../patchfile
) &&
git diff master >actual &&
diff -u expect actual
test_cmp expect actual
'

test_expect_success 'am regularly from file in subdirectory with full path' '
@ -66,7 +66,7 @@ test_expect_success 'am regularly from file in subdirectory with full path' ' @@ -66,7 +66,7 @@ test_expect_success 'am regularly from file in subdirectory with full path' '
git am "$P/patchfile"
) &&
git diff master >actual &&
diff -u expect actual
test_cmp expect actual
'

test_done

2
t/t4200-rerere.sh

@ -129,7 +129,7 @@ test_expect_success 'rerere kicked in' "! grep ======= a1" @@ -129,7 +129,7 @@ test_expect_success 'rerere kicked in' "! grep ======= a1"
test_expect_success 'rerere prefers first change' 'git diff a1 expect'

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

test_expect_success 'rerere clear' 'git rerere clear'


2
t/t4201-shortlog.sh

@ -45,7 +45,7 @@ A U Thor (5): @@ -45,7 +45,7 @@ A U Thor (5):

EOF

test_expect_success 'shortlog wrapping' 'diff -u expect out'
test_expect_success 'shortlog wrapping' 'test_cmp expect out'

git log HEAD > log
GIT_DIR=non-existing git shortlog -w < log > out

2
t/t5300-pack-object.sh

@ -15,7 +15,7 @@ test_expect_success \ @@ -15,7 +15,7 @@ test_expect_success \
'rm -f .git/index*
for i in a b c
do
dd if=/dev/zero bs=4k count=1 | tr "\\000" $i >$i &&
dd if=/dev/zero bs=4k count=1 | perl -pe "y/\\000/$i/" >$i &&
git update-index --add $i || return 1
done &&
cat c >d && echo foo >>d && git update-index --add d &&

4
t/t5302-pack-index.sh

@ -103,7 +103,7 @@ test_expect_success \ @@ -103,7 +103,7 @@ test_expect_success \
test_expect_success \
'[index v1] 2) create a stealth corruption in a delta base reference' \
'# this test assumes a delta smaller than 16 bytes at the end of the pack
git show-index <1.idx | sort -n | tail -n 1 | (
git show-index <1.idx | sort -n | sed -ne \$p | (
read delta_offs delta_sha1 &&
git cat-file blob "$delta_sha1" > blob_1 &&
chmod +w ".git/objects/pack/pack-${pack1}.pack" &&
@ -141,7 +141,7 @@ test_expect_success \ @@ -141,7 +141,7 @@ test_expect_success \
test_expect_success \
'[index v2] 2) create a stealth corruption in a delta base reference' \
'# this test assumes a delta smaller than 16 bytes at the end of the pack
git show-index <1.idx | sort -n | tail -n 1 | (
git show-index <1.idx | sort -n | sed -ne \$p | (
read delta_offs delta_sha1 delta_crc &&
git cat-file blob "$delta_sha1" > blob_3 &&
chmod +w ".git/objects/pack/pack-${pack1}.pack" &&

2
t/t5400-send-pack.sh

@ -120,7 +120,7 @@ test_expect_success \ @@ -120,7 +120,7 @@ test_expect_success \
cd .. &&
git-clone parent child && cd child && git-push --all &&
cd ../parent &&
git-branch -a >branches && ! grep -q origin/master branches
git-branch -a >branches && ! grep origin/master branches
'

rewound_push_setup() {

6
t/t5505-remote.sh

@ -24,7 +24,7 @@ setup_repository () { @@ -24,7 +24,7 @@ setup_repository () {
tokens_match () {
echo "$1" | tr ' ' '\012' | sort | sed -e '/^$/d' >expect &&
echo "$2" | tr ' ' '\012' | sort | sed -e '/^$/d' >actual &&
diff -u expect actual
test_cmp expect actual
}

check_remote_track () {
@ -73,7 +73,7 @@ test_expect_success 'add another remote' ' @@ -73,7 +73,7 @@ test_expect_success 'add another remote' '
sed -e "/^refs\/remotes\/origin\//d" \
-e "/^refs\/remotes\/second\//d" >actual &&
>expect &&
diff -u expect actual
test_cmp expect actual
)
'

@ -93,7 +93,7 @@ test_expect_success 'remove remote' ' @@ -93,7 +93,7 @@ test_expect_success 'remove remote' '
git for-each-ref "--format=%(refname)" refs/remotes |
sed -e "/^refs\/remotes\/origin\//d" >actual &&
>expect &&
diff -u expect actual
test_cmp expect actual
)
'


2
t/t5510-fetch.sh

@ -249,7 +249,7 @@ test_expect_success 'bundle should record HEAD correctly' ' @@ -249,7 +249,7 @@ test_expect_success 'bundle should record HEAD correctly' '
do
echo "$(git rev-parse --verify $h) $h"
done >expect &&
diff -u expect actual
test_cmp expect actual

'


8
t/t5512-ls-remote.sh

@ -24,28 +24,28 @@ test_expect_success setup ' @@ -24,28 +24,28 @@ test_expect_success setup '
test_expect_success 'ls-remote --tags .git' '

git ls-remote --tags .git >actual &&
diff -u expected.tag actual
test_cmp expected.tag actual

'

test_expect_success 'ls-remote .git' '

git ls-remote .git >actual &&
diff -u expected.all actual
test_cmp expected.all actual

'

test_expect_success 'ls-remote --tags self' '

git ls-remote --tags self >actual &&
diff -u expected.tag actual
test_cmp expected.tag actual

'

test_expect_success 'ls-remote self' '

git ls-remote self >actual &&
diff -u expected.all actual
test_cmp expected.all actual

'


8
t/t6000lib.sh

@ -97,7 +97,13 @@ check_output() @@ -97,7 +97,13 @@ check_output()
# from front and back.
name_from_description()
{
tr "'" '-' | tr '~`!@#$%^&*()_+={}[]|\;:"<>,/? ' '-' | tr -s '-' | tr '[A-Z]' '[a-z]' | sed "s/^-*//;s/-*\$//"
perl -pe '
s/[^A-Za-z0-9.]/-/g;
s/-+/-/g;
s/-$//;
s/^-//;
y/A-Z/a-z/;
'
}



2
t/t6004-rev-list-path-optim.sh

@ -45,7 +45,7 @@ test_expect_success 'further setup' ' @@ -45,7 +45,7 @@ test_expect_success 'further setup' '
test_expect_success 'path optimization 2' '
( echo "$side"; echo "$initial" ) >expected &&
git rev-list HEAD -- a >actual &&
diff -u expected actual
test_cmp expected actual
'

test_done

2
t/t6009-rev-list-parent.sh

@ -31,7 +31,7 @@ test_expect_failure 'one is ancestor of others and should not be shown' ' @@ -31,7 +31,7 @@ test_expect_failure 'one is ancestor of others and should not be shown' '

git rev-list one --not four >result &&
>expect &&
diff -u expect result
test_cmp expect result

'


4
t/t6027-merge-binary.sh

@ -45,7 +45,7 @@ test_expect_success resolve ' @@ -45,7 +45,7 @@ test_expect_success resolve '
false
else
git ls-files -s >current
diff -u current expect
test_cmp current expect
fi
'

@ -60,7 +60,7 @@ test_expect_success recursive ' @@ -60,7 +60,7 @@ test_expect_success recursive '
false
else
git ls-files -s >current
diff -u current expect
test_cmp current expect
fi
'


2
t/t6029-merge-subtree.sh

@ -25,7 +25,7 @@ test_expect_success 'subtree available and works like recursive' ' @@ -25,7 +25,7 @@ test_expect_success 'subtree available and works like recursive' '

git merge -s subtree side &&
for i in mundo $s world; do echo $i; done >expect &&
diff -u expect hello
test_cmp expect hello

'


6
t/t6030-bisect-porcelain.sh

@ -219,7 +219,7 @@ test_expect_success 'bisect run & skip: cannot tell between 2' ' @@ -219,7 +219,7 @@ test_expect_success 'bisect run & skip: cannot tell between 2' '
add_line_into_file "6: Yet a line." hello &&
HASH6=$(git rev-parse --verify HEAD) &&
echo "#"\!"/bin/sh" > test_script.sh &&
echo "tail -1 hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
echo "sed -ne \\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
echo "grep line hello > /dev/null" >> test_script.sh &&
echo "test \$? -ne 0" >> test_script.sh &&
chmod +x test_script.sh &&
@ -244,8 +244,8 @@ test_expect_success 'bisect run & skip: find first bad' ' @@ -244,8 +244,8 @@ test_expect_success 'bisect run & skip: find first bad' '
add_line_into_file "7: Should be the last line." hello &&
HASH7=$(git rev-parse --verify HEAD) &&
echo "#"\!"/bin/sh" > test_script.sh &&
echo "tail -1 hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
echo "tail -1 hello | grep day > /dev/null && exit 125" >> test_script.sh &&
echo "sed -ne \\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
echo "sed -ne \\\$p hello | grep day > /dev/null && exit 125" >> test_script.sh &&
echo "grep Yet hello > /dev/null" >> test_script.sh &&
echo "test \$? -ne 0" >> test_script.sh &&
chmod +x test_script.sh &&

2
t/t7003-filter-branch.sh

@ -4,7 +4,7 @@ test_description='git-filter-branch' @@ -4,7 +4,7 @@ test_description='git-filter-branch'
. ./test-lib.sh

make_commit () {
lower=$(echo $1 | tr A-Z a-z)
lower=$(echo $1 | tr '[A-Z]' '[a-z]')
echo $lower > $lower
git add $lower
test_tick

18
t/t7010-setup.sh

@ -18,7 +18,7 @@ test_expect_success 'git add (absolute)' ' @@ -18,7 +18,7 @@ test_expect_success 'git add (absolute)' '
git add "$D/a/b/c/d" &&
git ls-files >current &&
echo a/b/c/d >expect &&
diff -u expect current
test_cmp expect current

'

@ -32,7 +32,7 @@ test_expect_success 'git add (funny relative)' ' @@ -32,7 +32,7 @@ test_expect_success 'git add (funny relative)' '
) &&
git ls-files >current &&
echo a/e/f >expect &&
diff -u expect current
test_cmp expect current

'

@ -43,7 +43,7 @@ test_expect_success 'git rm (absolute)' ' @@ -43,7 +43,7 @@ test_expect_success 'git rm (absolute)' '
git rm -f --cached "$D/a/b/c/d" &&
git ls-files >current &&
echo a/e/f >expect &&
diff -u expect current
test_cmp expect current

'

@ -57,7 +57,7 @@ test_expect_success 'git rm (funny relative)' ' @@ -57,7 +57,7 @@ test_expect_success 'git rm (funny relative)' '
) &&
git ls-files >current &&
echo a/b/c/d >expect &&
diff -u expect current
test_cmp expect current

'

@ -67,7 +67,7 @@ test_expect_success 'git ls-files (absolute)' ' @@ -67,7 +67,7 @@ test_expect_success 'git ls-files (absolute)' '
git add a &&
git ls-files "$D/a/e/../b" >current &&
echo a/b/c/d >expect &&
diff -u expect current
test_cmp expect current

'

@ -80,7 +80,7 @@ test_expect_success 'git ls-files (relative #1)' ' @@ -80,7 +80,7 @@ test_expect_success 'git ls-files (relative #1)' '
git ls-files "../b/c"
) >current &&
echo c/d >expect &&
diff -u expect current
test_cmp expect current

'

@ -93,7 +93,7 @@ test_expect_success 'git ls-files (relative #2)' ' @@ -93,7 +93,7 @@ test_expect_success 'git ls-files (relative #2)' '
git ls-files --full-name "../e/f"
) >current &&
echo a/e/f >expect &&
diff -u expect current
test_cmp expect current

'

@ -126,13 +126,13 @@ test_expect_success 'log using absolute path names' ' @@ -126,13 +126,13 @@ test_expect_success 'log using absolute path names' '

git log a/b/c/d >f1.txt &&
git log "$(pwd)/a/b/c/d" >f2.txt &&
diff -u f1.txt f2.txt
test_cmp f1.txt f2.txt
'

test_expect_success 'blame using absolute path names' '
git blame a/b/c/d >f1.txt &&
git blame "$(pwd)/a/b/c/d" >f2.txt &&
diff -u f1.txt f2.txt
test_cmp f1.txt f2.txt
'

test_expect_success 'setup deeper work tree' '

18
t/t7201-co.sh

@ -83,13 +83,13 @@ test_expect_success "checkout with unrelated dirty tree without -m" ' @@ -83,13 +83,13 @@ test_expect_success "checkout with unrelated dirty tree without -m" '
fill 0 1 2 3 4 5 6 7 8 >same &&
cp same kept
git checkout side >messages &&
diff -u same kept
test_cmp same kept
(cat > messages.expect <<EOF
M same
EOF
) &&
touch messages.expect &&
diff -u messages.expect messages
test_cmp messages.expect messages
'

test_expect_success "checkout -m with dirty tree" '
@ -106,19 +106,19 @@ test_expect_success "checkout -m with dirty tree" ' @@ -106,19 +106,19 @@ test_expect_success "checkout -m with dirty tree" '
M one
EOF
) &&
diff -u expect.messages messages &&
test_cmp expect.messages messages &&

fill "M one" "A three" "D two" >expect.master &&
git diff --name-status master >current.master &&
diff -u expect.master current.master &&
test_cmp expect.master current.master &&

fill "M one" >expect.side &&
git diff --name-status side >current.side &&
diff -u expect.side current.side &&
test_cmp expect.side current.side &&

: >expect.index &&
git diff --cached >current.index &&
diff -u expect.index current.index
test_cmp expect.index current.index
'

test_expect_success "checkout -m with dirty tree, renamed" '
@ -136,7 +136,7 @@ test_expect_success "checkout -m with dirty tree, renamed" ' @@ -136,7 +136,7 @@ test_expect_success "checkout -m with dirty tree, renamed" '

git checkout -m renamer &&
fill 1 3 4 5 7 8 >expect &&
diff -u expect uno &&
test_cmp expect uno &&
! test -f one &&
git diff --cached >current &&
! test -s current
@ -161,7 +161,7 @@ test_expect_success 'checkout -m with merge conflict' ' @@ -161,7 +161,7 @@ test_expect_success 'checkout -m with merge conflict' '
git diff master:one :3:uno |
sed -e "1,/^@@/d" -e "/^ /d" -e "s/^-/d/" -e "s/^+/a/" >current &&
fill d2 aT d7 aS >expect &&
diff -u current expect &&
test_cmp current expect &&
git diff --cached two >current &&
! test -s current
'
@ -178,7 +178,7 @@ If you want to create a new branch from this checkout, you may do so @@ -178,7 +178,7 @@ If you want to create a new branch from this checkout, you may do so
HEAD is now at 7329388... Initial A one, A two
EOF
) &&
diff -u messages.expect messages &&
test_cmp messages.expect messages &&
H=$(git rev-parse --verify HEAD) &&
M=$(git show-ref -s --verify refs/heads/master) &&
test "z$H" = "z$M" &&

14
t/t7501-commit.sh

@ -203,7 +203,7 @@ test_expect_success 'sign off (1)' ' @@ -203,7 +203,7 @@ test_expect_success 'sign off (1)' '
git var GIT_COMMITTER_IDENT |
sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
) >expected &&
diff -u expected actual
test_cmp expected actual

'

@ -223,7 +223,7 @@ $existing" && @@ -223,7 +223,7 @@ $existing" &&
git var GIT_COMMITTER_IDENT |
sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
) >expected &&
diff -u expected actual
test_cmp expected actual

'

@ -240,7 +240,7 @@ test_expect_success 'multiple -m' ' @@ -240,7 +240,7 @@ test_expect_success 'multiple -m' '
echo
echo three
) >expected &&
diff -u expected actual
test_cmp expected actual

'

@ -301,12 +301,12 @@ test_expect_success 'same tree (merge and amend merge)' ' @@ -301,12 +301,12 @@ test_expect_success 'same tree (merge and amend merge)' '
git merge -s ours side -m "empty ok" &&
git diff HEAD^ HEAD >actual &&
: >expected &&
diff -u expected actual &&
test_cmp expected actual &&

git commit --amend -m "empty really ok" &&
git diff HEAD^ HEAD >actual &&
: >expected &&
diff -u expected actual
test_cmp expected actual

'

@ -323,7 +323,7 @@ test_expect_success 'amend using the message from another commit' ' @@ -323,7 +323,7 @@ test_expect_success 'amend using the message from another commit' '
git commit --allow-empty --amend -C "$old" &&
git show --pretty="format:%ad %s" "$old" >expected &&
git show --pretty="format:%ad %s" HEAD >actual &&
diff -u expected actual
test_cmp expected actual

'

@ -341,7 +341,7 @@ test_expect_success 'amend using the message from a commit named with tag' ' @@ -341,7 +341,7 @@ test_expect_success 'amend using the message from a commit named with tag' '
git commit --allow-empty --amend -C tagged-old &&
git show --pretty="format:%ad %s" "$old" >expected &&
git show --pretty="format:%ad %s" HEAD >actual &&
diff -u expected actual
test_cmp expected actual

'


14
t/t7502-commit.sh

@ -85,7 +85,7 @@ test_expect_success 'verbose' ' @@ -85,7 +85,7 @@ test_expect_success 'verbose' '
git add negative &&
git status -v | sed -ne "/^diff --git /p" >actual &&
echo "diff --git a/negative b/negative" >expect &&
diff -u expect actual
test_cmp expect actual

'

@ -95,7 +95,7 @@ test_expect_success 'cleanup commit messages (verbatim,-t)' ' @@ -95,7 +95,7 @@ test_expect_success 'cleanup commit messages (verbatim,-t)' '
{ echo;echo "# text";echo; } >expect &&
git commit --cleanup=verbatim -t expect -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d" |head -n 3 >actual &&
diff -u expect actual
test_cmp expect actual

'

@ -104,7 +104,7 @@ test_expect_success 'cleanup commit messages (verbatim,-F)' ' @@ -104,7 +104,7 @@ test_expect_success 'cleanup commit messages (verbatim,-F)' '
echo >>negative &&
git commit --cleanup=verbatim -F expect -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
diff -u expect actual
test_cmp expect actual

'

@ -113,7 +113,7 @@ test_expect_success 'cleanup commit messages (verbatim,-m)' ' @@ -113,7 +113,7 @@ test_expect_success 'cleanup commit messages (verbatim,-m)' '
echo >>negative &&
git commit --cleanup=verbatim -m "$(cat expect)" -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
diff -u expect actual
test_cmp expect actual

'

@ -124,7 +124,7 @@ test_expect_success 'cleanup commit messages (whitespace,-F)' ' @@ -124,7 +124,7 @@ test_expect_success 'cleanup commit messages (whitespace,-F)' '
echo "# text" >expect &&
git commit --cleanup=whitespace -F text -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
diff -u expect actual
test_cmp expect actual

'

@ -135,7 +135,7 @@ test_expect_success 'cleanup commit messages (strip,-F)' ' @@ -135,7 +135,7 @@ test_expect_success 'cleanup commit messages (strip,-F)' '
echo sample >expect &&
git commit --cleanup=strip -F text -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
diff -u expect actual
test_cmp expect actual

'

@ -150,7 +150,7 @@ test_expect_success 'cleanup commit messages (strip,-F,-e)' ' @@ -150,7 +150,7 @@ test_expect_success 'cleanup commit messages (strip,-F,-e)' '
{ echo;echo sample;echo; } >text &&
git commit -e -F text -a &&
head -n 4 .git/COMMIT_EDITMSG >actual &&
diff -u expect actual
test_cmp expect actual

'


4
t/t7502-status.sh

@ -33,7 +33,7 @@ test_expect_success 'setup' ' @@ -33,7 +33,7 @@ test_expect_success 'setup' '

test_expect_success 'status (1)' '

grep -e "use \"git rm --cached <file>\.\.\.\" to unstage" output
grep "use \"git rm --cached <file>\.\.\.\" to unstage" output

'

@ -146,7 +146,7 @@ cat <<EOF >expect @@ -146,7 +146,7 @@ cat <<EOF >expect
EOF
test_expect_success 'status of partial commit excluding new file in index' '
git status dir1/modified >output &&
diff -u expect output
test_cmp expect output
'

test_done

5
t/t7505-prepare-commit-msg-hook.sh

@ -25,8 +25,9 @@ export FAKE_EDITOR @@ -25,8 +25,9 @@ export FAKE_EDITOR
HOOKDIR="$(git rev-parse --git-dir)/hooks"
HOOK="$HOOKDIR/prepare-commit-msg"
mkdir -p "$HOOKDIR"
cat > "$HOOK" <<'EOF'
#!/bin/sh
echo "#!$SHELL_PATH" > "$HOOK"
cat >> "$HOOK" <<'EOF'

if test "$2" = commit; then
source=$(git-rev-parse "$3")
else

8
t/t7600-merge.sh

@ -108,7 +108,7 @@ create_merge_msgs() { @@ -108,7 +108,7 @@ create_merge_msgs() {
}

verify_diff() {
if ! diff -u "$1" "$2"
if ! test_cmp "$1" "$2"
then
echo "$3"
false
@ -165,7 +165,7 @@ verify_mergeheads() { @@ -165,7 +165,7 @@ verify_mergeheads() {
fi &&
while test $# -gt 0
do
head=$(head -n $i .git/MERGE_HEAD | tail -n 1)
head=$(head -n $i .git/MERGE_HEAD | sed -ne \$p)
if test "$1" != "$head"
then
echo "[OOPS] MERGE_HEAD $i != $1"
@ -371,7 +371,7 @@ test_expect_success 'override config option -n' ' @@ -371,7 +371,7 @@ test_expect_success 'override config option -n' '
git merge --summary c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 &&
verify_parents $c1 $c2 &&
if ! grep -e "^ file | *2 +-$" diffstat.txt
if ! grep "^ file | *2 +-$" diffstat.txt
then
echo "[OOPS] diffstat was not generated"
fi
@ -386,7 +386,7 @@ test_expect_success 'override config option --summary' ' @@ -386,7 +386,7 @@ test_expect_success 'override config option --summary' '
git merge -n c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 &&
verify_parents $c1 $c2 &&
if grep -e "^ file | *2 +-$" diffstat.txt
if grep "^ file | *2 +-$" diffstat.txt
then
echo "[OOPS] diffstat was generated"
false

4
t/t8003-blame.sh

@ -112,7 +112,7 @@ test_expect_success 'blame wholesale copy' ' @@ -112,7 +112,7 @@ test_expect_success 'blame wholesale copy' '
echo mouse-Second
echo mouse-Third
} >expected &&
diff -u expected current
test_cmp expected current

'

@ -125,7 +125,7 @@ test_expect_success 'blame wholesale copy and more' ' @@ -125,7 +125,7 @@ test_expect_success 'blame wholesale copy and more' '
echo cow-Fifth
echo mouse-Third
} >expected &&
diff -u expected current
test_cmp expected current

'


2
t/t9001-send-email.sh

@ -81,7 +81,7 @@ test_expect_success 'Show all headers' ' @@ -81,7 +81,7 @@ test_expect_success 'Show all headers' '
-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
>actual-show-all-headers &&
diff -u expected-show-all-headers actual-show-all-headers
test_cmp expected-show-all-headers actual-show-all-headers
'

z8=zzzzzzzz

2
t/t9112-git-svn-md5less-file.sh

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
#!/bin/sh

test_description='test that git handles an svn repository with missing md5sums'

. ./lib-git-svn.sh

24
t/t9116-git-svn-log.sh

@ -55,74 +55,74 @@ printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4 @@ -55,74 +55,74 @@ printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4

test_expect_success 'test ascending revision range' "
git reset --hard trunk &&
git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r1-r2-r4 -
git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
"

printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1

test_expect_success 'test descending revision range' "
git reset --hard trunk &&
git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4-r2-r1 -
git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -
"

printf 'r1 \nr2 \n' > expected-range-r1-r2

test_expect_success 'test ascending revision range with unreachable revision' "
git reset --hard trunk &&
git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r1-r2 -
git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -
"

printf 'r2 \nr1 \n' > expected-range-r2-r1

test_expect_success 'test descending revision range with unreachable revision' "
git reset --hard trunk &&
git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2-r1 -
git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -
"

printf 'r2 \n' > expected-range-r2

test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' "
git reset --hard trunk &&
git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2 -
git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
"

test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' "
git reset --hard trunk &&
git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2 -
git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
"

printf 'r4 \n' > expected-range-r4

test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' "
git reset --hard trunk &&
git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 -
git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
"

test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' "
git reset --hard trunk &&
git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 -
git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
"

printf -- '------------------------------------------------------------------------\n' > expected-separator

test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' "
git reset --hard trunk &&
git svn log -r 5:6 | diff -u expected-separator -
git svn log -r 5:6 | test_cmp expected-separator -
"

test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' "
git reset --hard trunk &&
git svn log -r 6:5 | diff -u expected-separator -
git svn log -r 6:5 | test_cmp expected-separator -
"

test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' "
git reset --hard trunk &&
git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 -
git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
"

test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' "
git reset --hard trunk &&
git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 -
git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
"

test_done

14
t/t9200-git-cvsexportcommit.sh

@ -37,7 +37,7 @@ check_entries () { @@ -37,7 +37,7 @@ check_entries () {
else
printf '%s\n' "$2" | tr '|' '\012' >expected
fi
diff -u expected actual
test_cmp expected actual
}

test_expect_success \
@ -257,8 +257,8 @@ test_expect_success '-w option should work with relative GIT_DIR' ' @@ -257,8 +257,8 @@ test_expect_success '-w option should work with relative GIT_DIR' '
(cd "$GIT_DIR" &&
GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id &&
check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" &&
diff -u "$CVSWORK/W/file1.txt" ../W/file1.txt &&
diff -u "$CVSWORK/W/file2.txt" ../W/file2.txt
test_cmp "$CVSWORK/W/file1.txt" ../W/file1.txt &&
test_cmp "$CVSWORK/W/file2.txt" ../W/file2.txt
)
'

@ -279,9 +279,9 @@ test_expect_success 'check files before directories' ' @@ -279,9 +279,9 @@ test_expect_success 'check files before directories' '
git cvsexportcommit -w "$CVSWORK" -c $id &&
check_entries "$CVSWORK/E" "DS/1.1/|newfile5.txt/1.1/" &&
check_entries "$CVSWORK" "DS/1.1/|release-notes/1.2/" &&
diff -u "$CVSWORK/DS" DS &&
diff -u "$CVSWORK/E/DS" E/DS &&
diff -u "$CVSWORK/release-notes" release-notes
test_cmp "$CVSWORK/DS" DS &&
test_cmp "$CVSWORK/E/DS" E/DS &&
test_cmp "$CVSWORK/release-notes" release-notes

'

@ -293,7 +293,7 @@ test_expect_success 'commit a file with leading spaces in the name' ' @@ -293,7 +293,7 @@ test_expect_success 'commit a file with leading spaces in the name' '
id=$(git rev-parse HEAD) &&
git cvsexportcommit -w "$CVSWORK" -c $id &&
check_entries "$CVSWORK" " space/1.1/|DS/1.1/|release-notes/1.2/" &&
diff -u "$CVSWORK/ space" " space"
test_cmp "$CVSWORK/ space" " space"

'


28
t/t9400-git-cvsserver-server.sh

@ -54,7 +54,7 @@ test_expect_success 'setup' ' @@ -54,7 +54,7 @@ test_expect_success 'setup' '
test_expect_success 'basic checkout' \
'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master &&
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/"
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | tail -n 1))" = "secondrootfile/1.1/"'
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | sed -ne \$p))" = "secondrootfile/1.1/"'

#------------------------
# PSERVER AUTHENTICATION
@ -94,7 +94,7 @@ EOF @@ -94,7 +94,7 @@ EOF

test_expect_success 'pserver authentication' \
'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
sed -ne \$p log | grep "^I LOVE YOU$"'

test_expect_success 'pserver authentication failure (non-anonymous user)' \
'if cat request-git | git-cvsserver pserver >log 2>&1
@ -103,11 +103,11 @@ test_expect_success 'pserver authentication failure (non-anonymous user)' \ @@ -103,11 +103,11 @@ test_expect_success 'pserver authentication failure (non-anonymous user)' \
else
true
fi &&
tail -n1 log | grep -q "^I HATE YOU$"'
sed -ne \$p log | grep "^I HATE YOU$"'

test_expect_success 'pserver authentication (login)' \
'cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
sed -ne \$p log | grep "^I LOVE YOU$"'

test_expect_success 'pserver authentication failure (login/non-anonymous user)' \
'if cat login-git | git-cvsserver pserver >log 2>&1
@ -116,7 +116,7 @@ test_expect_success 'pserver authentication failure (login/non-anonymous user)' @@ -116,7 +116,7 @@ test_expect_success 'pserver authentication failure (login/non-anonymous user)'
else
true
fi &&
tail -n1 log | grep -q "^I HATE YOU$"'
sed -ne \$p log | grep "^I HATE YOU$"'


# misuse pserver authentication for testing of req_Root
@ -146,15 +146,15 @@ test_expect_success 'req_Root failure (relative pathname)' \ @@ -146,15 +146,15 @@ test_expect_success 'req_Root failure (relative pathname)' \
else
true
fi &&
tail log | grep -q "^error 1 Root must be an absolute pathname$"'
tail log | grep "^error 1 Root must be an absolute pathname$"'

test_expect_success 'req_Root failure (conflicting roots)' \
'cat request-conflict | git-cvsserver pserver >log 2>&1 &&
tail log | grep -q "^error 1 Conflicting roots specified$"'
tail log | grep "^error 1 Conflicting roots specified$"'

test_expect_success 'req_Root (strict paths)' \
'cat request-anonymous | git-cvsserver --strict-paths pserver $SERVERDIR >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
sed -ne \$p log | grep "^I LOVE YOU$"'

test_expect_success 'req_Root failure (strict-paths)' '
! cat request-anonymous |
@ -163,7 +163,7 @@ test_expect_success 'req_Root failure (strict-paths)' ' @@ -163,7 +163,7 @@ test_expect_success 'req_Root failure (strict-paths)' '

test_expect_success 'req_Root (w/o strict-paths)' \
'cat request-anonymous | git-cvsserver pserver $WORKDIR/ >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
sed -ne \$p log | grep "^I LOVE YOU$"'

test_expect_success 'req_Root failure (w/o strict-paths)' '
! cat request-anonymous |
@ -181,7 +181,7 @@ EOF @@ -181,7 +181,7 @@ EOF

test_expect_success 'req_Root (base-path)' \
'cat request-base | git-cvsserver --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
sed -ne \$p log | grep "^I LOVE YOU$"'

test_expect_success 'req_Root failure (base-path)' '
! cat request-anonymous |
@ -192,14 +192,14 @@ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1 @@ -192,14 +192,14 @@ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1

test_expect_success 'req_Root (export-all)' \
'cat request-anonymous | git-cvsserver --export-all pserver $WORKDIR >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
sed -ne \$p log | grep "^I LOVE YOU$"'

test_expect_success 'req_Root failure (export-all w/o whitelist)' \
'! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'

test_expect_success 'req_Root (everything together)' \
'cat request-base | git-cvsserver --export-all --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
sed -ne \$p log | grep "^I LOVE YOU$"'

GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1

@ -216,7 +216,7 @@ test_expect_success 'gitcvs.enabled = false' \ @@ -216,7 +216,7 @@ test_expect_success 'gitcvs.enabled = false' \
else
true
fi &&
cat cvs.log | grep -q "GITCVS emulation disabled" &&
grep "GITCVS emulation disabled" cvs.log &&
test ! -d cvswork2'

rm -fr cvswork2
@ -237,7 +237,7 @@ test_expect_success 'gitcvs.ext.enabled = false' \ @@ -237,7 +237,7 @@ test_expect_success 'gitcvs.ext.enabled = false' \
else
true
fi &&
cat cvs.log | grep -q "GITCVS emulation disabled" &&
grep "GITCVS emulation disabled" cvs.log &&
test ! -d cvswork2'

rm -fr cvswork2

18
t/test-lib.sh

@ -42,6 +42,7 @@ export GIT_MERGE_VERBOSITY @@ -42,6 +42,7 @@ export GIT_MERGE_VERBOSITY
export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
export EDITOR VISUAL
GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}

# Protect ourselves from common misconfiguration to export
# CDPATH into the environment
@ -302,6 +303,23 @@ test_must_fail () { @@ -302,6 +303,23 @@ test_must_fail () {
test $? -gt 0 -a $? -le 128
}

# test_cmp is a helper function to compare actual and expected output.
# You can use it like:
#
# test_expect_success 'foo works' '
# echo expected >expected &&
# foo >actual &&
# test_cmp expected actual
# '
#
# This could be written as either "cmp" or "diff -u", but:
# - cmp's output is not nearly as easy to read as diff -u
# - not all diff versions understand "-u"

test_cmp() {
$GIT_TEST_CMP "$@"
}

# Most tests can use the created repository, but some may need to create more.
# Usage: test_create_repo <directory>
test_create_repo () {

4
test-sha1.sh

@ -10,7 +10,7 @@ do @@ -10,7 +10,7 @@ do
{
test -z "$pfx" || echo "$pfx"
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
tr '\000' 'g'
perl -pe 'y/\000/g/'
} | ./test-sha1 $cnt
`
if test "$expect" = "$actual"
@ -55,7 +55,7 @@ do @@ -55,7 +55,7 @@ do
{
test -z "$pfx" || echo "$pfx"
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
tr '\000' 'g'
perl -pe 'y/\000/g/'
} | sha1sum |
sed -e 's/ .*//'
`

Loading…
Cancel
Save