Code

add test_cmp function for test scripts
authorJeff King <peff@peff.net>
Wed, 12 Mar 2008 21:36:36 +0000 (17:36 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 13 Mar 2008 07:57:52 +0000 (00:57 -0700)
commit82ebb0b6ec7470cab96a013d3d719c109003ef83
tree8796598a518e972881afd729215c265924c04ddf
parentb4ce54fc61e7c76e2d7f47c34733f0f0bbb6c4cd
add test_cmp function for test scripts

Many scripts compare actual and expected output using
"diff -u". This is nicer than "cmp" because the output shows
how the two differ. However, not all versions of diff
understand -u, leading to unnecessary test failure.

This adds a test_cmp function to the test scripts and
switches all "diff -u" invocations to use it. The function
uses the contents of "$GIT_TEST_CMP" to compare its
arguments; the default is "diff -u".

On systems with a less-capable diff, you can do:

  GIT_TEST_CMP=cmp make test

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
40 files changed:
t/t0003-attributes.sh
t/t0022-crlf-rename.sh
t/t1005-read-tree-reset.sh
t/t2200-add-update.sh
t/t3001-ls-files-others-exclude.sh
t/t3050-subprojects-fetch.sh
t/t3060-ls-files-with-tree.sh
t/t3201-branch-contains.sh
t/t3404-rebase-interactive.sh
t/t3405-rebase-malformed.sh
t/t3406-rebase-message.sh
t/t3701-add-interactive.sh
t/t3902-quoted.sh
t/t3903-stash.sh
t/t4023-diff-rename-typechange.sh
t/t4024-diff-optimize-common.sh
t/t4025-hunk-header.sh
t/t4027-diff-submodule.sh
t/t4105-apply-fuzz.sh
t/t4125-apply-ws-fuzz.sh
t/t4150-am-subdir.sh
t/t4201-shortlog.sh
t/t5505-remote.sh
t/t5510-fetch.sh
t/t5512-ls-remote.sh
t/t6004-rev-list-path-optim.sh
t/t6009-rev-list-parent.sh
t/t6027-merge-binary.sh
t/t6029-merge-subtree.sh
t/t7010-setup.sh
t/t7201-co.sh
t/t7501-commit.sh
t/t7502-commit.sh
t/t7502-status.sh
t/t7600-merge.sh
t/t8003-blame.sh
t/t9001-send-email.sh
t/t9116-git-svn-log.sh
t/t9200-git-cvsexportcommit.sh
t/test-lib.sh