]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: fix incorrect --write-junit-xml code
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 14 Jul 2022 09:00:34 +0000 (09:00 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Jul 2022 17:02:06 +0000 (10:02 -0700)
In 78d5e4cfb4b (tests: refactor --write-junit-xml code, 2022-05-21),
this developer refactored the `--write-junit-xml` code a bit, including
the part where the current test case's title was used in a `set`
invocation, but failed to account for the fact that some test cases'
titles start with a long option, which the `set` misinterprets as being
intended for parsing.

Let's fix this by using the `set -- <...>` form.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib-junit.sh

index c959183c7e2c84e699a2dd43ca0bca836988770f..79c31c788b921baa3118c918f731ed46b450393b 100644 (file)
@@ -46,7 +46,7 @@ finalize_test_case_output () {
        shift
        case "$test_case_result" in
        ok)
-               set "$*"
+               set -- "$*"
                ;;
        failure)
                junit_insert="<failure message=\"not ok $test_count -"
@@ -65,17 +65,17 @@ finalize_test_case_output () {
                        junit_insert="$junit_insert<system-err>$(xml_attr_encode \
                                "$(cat "$GIT_TEST_TEE_OUTPUT_FILE")")</system-err>"
                fi
-               set "$1" "      $junit_insert"
+               set -- "$1" "      $junit_insert"
                ;;
        fixed)
-               set "$* (breakage fixed)"
+               set -- "$* (breakage fixed)"
                ;;
        broken)
-               set "$* (known breakage)"
+               set -- "$* (known breakage)"
                ;;
        skip)
                message="$(xml_attr_encode --no-lf "$skipped_reason")"
-               set "$1" "      <skipped message=\"$message\" />"
+               set -- "$1" "      <skipped message=\"$message\" />"
                ;;
        esac