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 <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Nov 12, 2019 at 11:38 UTC
c593a2634837234c91afc875cb569a53fbaadbfb
1 file changed
+4
-6
t/t6120-describe.sh
+4
-6
@@ -16,14 +16,12 @@ test_description='test describe'
16
check_describe () {
17
expect="$1"
18
shift
19
- R=$(git describe "$@" 2>err.actual)
20
- S=$?
21
- cat err.actual >&3
22
- test_expect_success "describe $*" '
23
- test $S = 0 &&
19
+ describe_opts="$@"
20
+ test_expect_success "describe $describe_opts" '
21
+ R=$(git describe $describe_opts 2>err.actual) &&
22
case "$R" in
23
$expect) echo happy ;;
26
- *) echo "Oops - $R is not $expect";
24
+ *) echo "Oops - $R is not $expect" &&
25
false ;;
26
esac
27
'