From dde1d730586f6fbdc26b61d0b99ee18c188f1892 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 11 Dec 2013 16:32:11 +0000 Subject: [PATCH] Check that the target branch exists * propose_requirements_update.sh: Look before we leap. Don't descend into the project repository and try to check out a branch without first making sure it exists on the origin. Change-Id: Ib4de5bdf8bf5cf134e3307755617456f282d790d --- .../propose_requirements_update.sh | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/modules/jenkins/files/slave_scripts/propose_requirements_update.sh b/modules/jenkins/files/slave_scripts/propose_requirements_update.sh index 6c42a99e45..c57a6c116f 100755 --- a/modules/jenkins/files/slave_scripts/propose_requirements_update.sh +++ b/modules/jenkins/files/slave_scripts/propose_requirements_update.sh @@ -56,29 +56,32 @@ EOF PROJECT_DIR=$(basename $PROJECT) rm -rf $PROJECT_DIR git clone ssh://$USERNAME@review.openstack.org:29418/$PROJECT.git - pushd $PROJECT_DIR - git checkout $BRANCH - git review -s - if [ -n "$change_id" ] ; then - git review -d $change_id - fi - popd - python update.py $PROJECT_DIR - - pushd $PROJECT_DIR - if ! git diff --exit-code HEAD ; then - # Commit and review - git_args="-a -F-" + # make sure the project even has this branch + if git branch -a | grep -q "^ remotes/origin/$BRANCH$" ; then + git checkout $BRANCH + git review -s if [ -n "$change_id" ] ; then - git_args="--amend $git_args" + git review -d $change_id fi - git commit $git_args <