diff options
Diffstat (limited to 't/t5411/common-functions.sh')
-rw-r--r-- | t/t5411/common-functions.sh | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/t/t5411/common-functions.sh b/t/t5411/common-functions.sh index 344d13f61a..6694858e18 100644 --- a/t/t5411/common-functions.sh +++ b/t/t5411/common-functions.sh @@ -36,9 +36,8 @@ create_commits_in () { # without having to worry about future changes of the commit ID and spaces # of the output. Single quotes are replaced with double quotes, because # it is boring to prepare unquoted single quotes in expect text. We also -# remove some locale error messages, which break test if we turn on -# `GIT_TEST_GETTEXT_POISON=true` in order to test unintentional translations -# on plumbing commands. +# remove some locale error messages. The emitted human-readable errors are +# redundant to the more machine-readable output the tests already assert. make_user_friendly_and_stable_output () { sed \ -e "s/ *\$//" \ @@ -59,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 +} |