Commit 4b99e884 authored by Jan Kiene's avatar Jan Kiene
Browse files

[hotfix] fix for get-float-ref-branch-name.sh

The default float ref name needs to be returned if the branch name does
not follow the porting naming convention. The previous behaviour was
buggy as it would simply return the name of the branch itself if that
did not follow the naming conventions
parent dd6c9a52
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
# the United Nations Convention on Contracts on the International Sales of Goods.

# NOTE: this does not check e.g. for float_ref_branchname actually existing and will silently return ivas-float-update if not
#       Use branch-follows-porting-naming-convention.sh for that

if [ $# -ne 1 ]; then
  echo "Usage: $0 <branchname>"
@@ -39,6 +38,12 @@ fi
branchname_in="$1"
branchname_out="ivas-float-update"

exit_code=0
bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-naming-convention.sh || exit_code=$?

# if this branch follows the naming convetions, we can try to get the corresponding float MR branch
# if this branch does NOT follow the porting naming convention, the float ref is just ivas-float-update, so skip everything
if [[ "exit_code" == "0" ]]; then
  # The float ref branch is just the same name, but with basop -> ref replacement
  # Replace only the first occurrence, as "basop" may be present in the later description
  # If the format is correct, then before "_basop", only numbers can occur
@@ -49,6 +54,7 @@ git_result=$(git branch -a)
  if [[ "$git_result" =~ "$float_ref_branchname" ]]; then
    branchname_out="${float_ref_branchname}"
  fi
fi

echo "$branchname_out"
exit 0