]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t6120-describe: modernize the 'check_describe' helper
authorSZEDER Gábor <szeder.dev@gmail.com>
Tue, 12 Nov 2019 10:38:10 +0000 (11:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Dec 2019 21:28:55 +0000 (13:28 -0800)
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 <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6120-describe.sh

index 9b184179d1098de576abbd19c06154c3e5660d0f..a2988fa0c2a437344f2da1f21b9550dcb0030621 100755 (executable)
@@ -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
        '