From: SZEDER Gábor Date: Tue, 12 Nov 2019 10:38:10 +0000 (+0100) Subject: t6120-describe: modernize the 'check_describe' helper X-Git-Tag: v2.25.0-rc0~14^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c593a2634837234c91afc875cb569a53fbaadbfb;p=thirdparty%2Fgit.git t6120-describe: modernize the 'check_describe' helper The 'check_describe' helper function runs 'git describe' outside of 'test_expect_success' blocks, with extra hand-rolled code to record and examine its exit code. Update this helper and move the 'git describe' invocation inside the 'test_expect_success' block. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 9b184179d1..a2988fa0c2 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -16,14 +16,12 @@ test_description='test describe' check_describe () { expect="$1" shift - R=$(git describe "$@" 2>err.actual) - S=$? - cat err.actual >&3 - test_expect_success "describe $*" ' - test $S = 0 && + describe_opts="$@" + test_expect_success "describe $describe_opts" ' + R=$(git describe $describe_opts 2>err.actual) && case "$R" in $expect) echo happy ;; - *) echo "Oops - $R is not $expect"; + *) echo "Oops - $R is not $expect" && false ;; esac '