From ce0daf5f41bea37ca8541f5e1335e16a87de35b0 Mon Sep 17 00:00:00 2001 From: Nathan Cutler Date: Wed, 4 Sep 2019 23:16:37 +0200 Subject: [PATCH] script/ceph-backport.sh: check name of current git branch The script expects the git branch containing the cherry-picked commits to be named using a certain format. Signed-off-by: Nathan Cutler --- src/script/ceph-backport.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/script/ceph-backport.sh b/src/script/ceph-backport.sh index 8f1c02c3552..0b0f6780d8b 100755 --- a/src/script/ceph-backport.sh +++ b/src/script/ceph-backport.sh @@ -403,17 +403,19 @@ debug "Milestone number is $milestone_number" local_branch=wip-${issue}-${target_branch} -if [ $(curl --silent ${redmine_url}.json | jq -r .issue.tracker.name) != "Backport" ] -then - error "${redmine_endpoint}/issues/${issue} is not in the Backport tracker" - exit 1 -fi - if [ "$PREPARE" ]; then debug "'--prepare' found, will only prepare the backport" prepare fi +current_branch=$(git rev-parse --abbrev-ref HEAD) +if [ "$current_branch" = "$local_branch" ] ; then + true # all is well +else + error "local branch is $current_branch, but I needed $local_branch" + exit 1 +fi + debug "Pushing local branch $local_branch to remote $github_repo" git push -u $github_repo $local_branch -- 2.39.5