]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ci: reorder definitions for grouping functions
authorPatrick Steinhardt <ps@pks.im>
Thu, 9 Nov 2023 08:05:25 +0000 (09:05 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Nov 2023 09:56:08 +0000 (18:56 +0900)
We define a set of grouping functions that are used to group together
output in our CI, where these groups then end up as collapsible sections
in the respective pipeline platform. The way these functions are defined
is not easily extensible though as we have an up front check for the CI
_not_ being GitHub Actions, where we define the non-stub logic in the
else branch.

Reorder the conditional branches such that we explicitly handle GitHub
Actions.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ci/lib.sh

index 369d462f1306fbca89442df9be35925ccc272489..26895ddbcc62b81ae5555d694565e5314add651c 100755 (executable)
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -1,16 +1,7 @@
 # Library of functions shared by all CI scripts
 
-if test true != "$GITHUB_ACTIONS"
+if test true = "$GITHUB_ACTIONS"
 then
-       begin_group () { :; }
-       end_group () { :; }
-
-       group () {
-               shift
-               "$@"
-       }
-       set -x
-else
        begin_group () {
                need_to_end_group=t
                echo "::group::$1" >&2
@@ -42,6 +33,15 @@ else
        }
 
        begin_group "CI setup"
+else
+       begin_group () { :; }
+       end_group () { :; }
+
+       group () {
+               shift
+               "$@"
+       }
+       set -x
 fi
 
 # Set 'exit on error' for all CI scripts to let the caller know that