Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-12-01 15:41:44 +0300
committerJunio C Hamano <gitster@pobox.com>2018-12-01 15:41:44 +0300
commit152cb0cdc3df641ee9d47d400058f424377dcaed (patch)
tree43f4b6df9c572bd42013dc78aec3531721b67982 /t
parent2c23f0b67e5ef908ee9ead3154199d4ad5f8b577 (diff)
parent30d0b6dccbc08d2146697f4369ac6bc78508a4c9 (diff)
Merge branch 'sg/test-cmp-rev'
Test framework update. * sg/test-cmp-rev: test-lib-functions: make 'test_cmp_rev' more informative on failure
Diffstat (limited to 't')
-rw-r--r--t/test-lib-functions.sh20
1 files changed, 17 insertions, 3 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index b4e391526a..589d93d15b 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -854,9 +854,23 @@ test_must_be_empty () {
# Tests that its two parameters refer to the same revision
test_cmp_rev () {
- git rev-parse --verify "$1" >expect.rev &&
- git rev-parse --verify "$2" >actual.rev &&
- test_cmp expect.rev actual.rev
+ if test $# != 2
+ then
+ error "bug in the test script: test_cmp_rev requires two revisions, but got $#"
+ else
+ local r1 r2
+ r1=$(git rev-parse --verify "$1") &&
+ r2=$(git rev-parse --verify "$2") &&
+ if test "$r1" != "$r2"
+ then
+ cat >&4 <<-EOF
+ error: two revisions point to different objects:
+ '$1': $r1
+ '$2': $r2
+ EOF
+ return 1
+ fi
+ fi
}
# Print a sequence of integers in increasing order, either with