From ccb03449692e42f4da45fb20cd46e08b648bca26 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Mon, 31 Jul 2023 15:07:49 +0200 Subject: [PATCH 1/2] test: add GIT alternative commands for older GIT versions The Docker container used for the CI has Git version 2.7.4 which does not support the "git branch --show-current" command since this was added in version 2.22. Therefore this commit adds an alternative version for old Git versions. Signed-off-by: Valerio Setti --- docs/architecture/psa-migration/outcome-analysis.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/architecture/psa-migration/outcome-analysis.sh b/docs/architecture/psa-migration/outcome-analysis.sh index b26963b90..d03c5a226 100755 --- a/docs/architecture/psa-migration/outcome-analysis.sh +++ b/docs/architecture/psa-migration/outcome-analysis.sh @@ -43,8 +43,15 @@ record() { fi } -# save current HEAD -HEAD=$(git branch --show-current) +# save current HEAD. +# Note: unfortunately "git branch --show-current" was added only in GIT +# version 2.22. +GIT_VERSION="$(git --version | sed 's/git version //')" +if dpkg --compare-versions "$GIT_VERSION" "gt" "2.22.0"; then + HEAD=$(git branch --show-current) +else + HEAD=$(git rev-parse --abbrev-ref HEAD) +fi # get the numbers before this PR for default and full cleanup From ab02d391cb6cd46d16407ccdd9b9dda4240e4e0b Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Mon, 31 Jul 2023 16:47:07 +0200 Subject: [PATCH 2/2] test: use only rev-parse for getting the current branch Signed-off-by: Valerio Setti --- docs/architecture/psa-migration/outcome-analysis.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/architecture/psa-migration/outcome-analysis.sh b/docs/architecture/psa-migration/outcome-analysis.sh index d03c5a226..1805a3ca0 100755 --- a/docs/architecture/psa-migration/outcome-analysis.sh +++ b/docs/architecture/psa-migration/outcome-analysis.sh @@ -44,14 +44,10 @@ record() { } # save current HEAD. -# Note: unfortunately "git branch --show-current" was added only in GIT -# version 2.22. -GIT_VERSION="$(git --version | sed 's/git version //')" -if dpkg --compare-versions "$GIT_VERSION" "gt" "2.22.0"; then - HEAD=$(git branch --show-current) -else - HEAD=$(git rev-parse --abbrev-ref HEAD) -fi +# Note: this can optionally be updated to +# HEAD=$(git branch --show-current) +# when using a Git version above 2.22 +HEAD=$(git rev-parse --abbrev-ref HEAD) # get the numbers before this PR for default and full cleanup