Commit 0bfb48a1 authored by Jan Kiene's avatar Jan Kiene
Browse files

fix printout redirection in script

parent 029abfef
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -28,11 +28,12 @@
# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
# 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

set -euo pipefail

# in this snippet, always print stuff to stderr and ONLY the final echo with of branchname_out should go to stdout
exec 3>&1 # save stdout on file desc 3
exec 1>&2 # send all stdout to stderr

if [ $# -ne 1 ]; then
  echo "Usage: $0 <branchname>"
  exit 1
@@ -50,8 +51,8 @@ float_ref_branchname="${branchname_in/basop/ref}"
# now check in ivas-codec repository if a branch with this name exits
exit_code_ls_remote=0
pushd "${SCRIPTS_DIR}"
git fetch origin >>/dev/null
git ls-remote --exit-code --heads origin refs/heads/$float_ref_branchname >>/dev/null || exit_code_ls_remote=$?
git fetch origin
git ls-remote --exit-code --heads origin refs/heads/$float_ref_branchname || exit_code_ls_remote=$?
popd

# If the branch does not exist, default to "ivas-float-update"
@@ -60,5 +61,5 @@ if [ "$exit_code_ls_remote" -eq "2" ]; then
  branchname_out="${float_ref_branchname}"
fi

echo "$branchname_out"
printf '%s\n' "$branchname_out" >&3
exit 0