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 <valerio.setti@nordicsemi.no>
diff --git a/docs/architecture/psa-migration/outcome-analysis.sh b/docs/architecture/psa-migration/outcome-analysis.sh
index b26963b..d03c5a2 100755
--- a/docs/architecture/psa-migration/outcome-analysis.sh
+++ b/docs/architecture/psa-migration/outcome-analysis.sh
@@ -43,8 +43,15 @@
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