From: Nathan Cutler Date: Tue, 19 Nov 2019 12:49:18 +0000 (+0100) Subject: ceph-backport.sh: restore "set -x" when in debug mode X-Git-Tag: v15.1.0~808^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=fb60d2ffcea2d8b89e22dc1feac7c69ffbfe9ee7;p=ceph-ci.git ceph-backport.sh: restore "set -x" when in debug mode Recently, "set -x"/"set +x" code was added to show the user which git commands the script is running. This code was inadvertently deactivating "set -x" when running in debug mode. Signed-off-by: Nathan Cutler --- diff --git a/src/script/ceph-backport.sh b/src/script/ceph-backport.sh index bf276a7306d..3ca96ab2c51 100755 --- a/src/script/ceph-backport.sh +++ b/src/script/ceph-backport.sh @@ -274,6 +274,7 @@ function cherry_pick_phase { fi else set +x + maybe_restore_set_x error "Cannot initialize $local_branch - local branch already exists" false fi @@ -284,6 +285,7 @@ function cherry_pick_phase { git fetch "$upstream_remote" "pull/$original_pr/head:pr-$original_pr" set +x + maybe_restore_set_x info "Attempting to cherry pick $number_of_commits commits from ${original_pr_url} into local branch $local_branch" offset="$((number_of_commits - 1))" || true for ((i=offset; i>=0; i--)) ; do @@ -292,8 +294,10 @@ function cherry_pick_phase { set -x if git cherry-pick -x "$sha1_to_cherry_pick" ; then set +x + maybe_restore_set_x else set +x + maybe_restore_set_x [ "$VERBOSE" ] && git status error "Cherry pick failed" info "Next, manually fix conflicts and complete the current cherry-pick" @@ -791,6 +795,7 @@ function maybe_delete_deprecated_backport_common { set -x rm -f "$deprecated_backport_common" set +x + maybe_restore_set_x fi fi if [ -e "$deprecated_backport_common" ] ; then @@ -800,6 +805,12 @@ function maybe_delete_deprecated_backport_common { fi } +function maybe_restore_set_x { + if [ "$DEBUG" ] ; then + set -x + fi +} + function maybe_update_pr_milestone_labels { local component local data_binary @@ -1619,11 +1630,13 @@ if [ "$PR_PHASE" ] ; then set -x git checkout "$local_branch" set +x + maybe_restore_set_x fi set -x git push -u "$fork_remote" "$local_branch" set +x + maybe_restore_set_x original_issue="" original_pr=""