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>
This commit is contained in:
parent
43cef57e51
commit
ccb0344969
1 changed files with 9 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue