summaryrefslogtreecommitdiff
path: root/t/t5411/common-functions.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-02-18 01:21:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-02-18 01:21:42 (GMT)
commitfdf3a27ca9f44d0c5597b2d1a018b02f09ba8602 (patch)
tree70dd59574abf2bc0c9f9cd7f0e37cf25f936324b /t/t5411/common-functions.sh
parent9e634a91c8b6f57508aa91bd7306194d6ef6c14a (diff)
parent822ee894f621674610a36cc9a84a9ffbbb8fb6bb (diff)
downloadgit-fdf3a27ca9f44d0c5597b2d1a018b02f09ba8602.zip
git-fdf3a27ca9f44d0c5597b2d1a018b02f09ba8602.tar.gz
git-fdf3a27ca9f44d0c5597b2d1a018b02f09ba8602.tar.bz2
Merge branch 'jx/t5411-unique-filenames'
Avoid individual tests in t5411 from getting affected by each other by forcing them to use separate output files during the test. * jx/t5411-unique-filenames: t5411: refactor check of refs using test_cmp_refs t5411: use different out file to prevent overwriting
Diffstat (limited to 't/t5411/common-functions.sh')
-rw-r--r--t/t5411/common-functions.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t5411/common-functions.sh b/t/t5411/common-functions.sh
index 13107fc..6694858 100644
--- a/t/t5411/common-functions.sh
+++ b/t/t5411/common-functions.sh
@@ -58,3 +58,18 @@ filter_out_user_friendly_and_stable_output () {
make_user_friendly_and_stable_output |
sed -n ${1+"$@"}
}
+
+test_cmp_refs () {
+ indir=
+ if test "$1" = "-C"
+ then
+ shift
+ indir="$1"
+ shift
+ fi
+ indir=${indir:+"$indir"/}
+ cat >show-ref.expect &&
+ git ${indir:+ -C "$indir"} show-ref >show-ref.pristine &&
+ make_user_friendly_and_stable_output <show-ref.pristine >show-ref.filtered &&
+ test_cmp show-ref.expect show-ref.filtered
+}