summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan S. Arnold <ryan.arnold@linaro.org>2015-07-09 17:13:15 -0500
committerRyan S. Arnold <ryan.arnold@linaro.org>2015-07-09 17:13:15 -0500
commita7415ec0ad28f59f9624fb26c9ed7bbf20005f54 (patch)
treebb42b4a0a90f1d49dc9c30197cc33f49c9b059b1
parent73d00b472eec7d583ffafcad5dc16202032ae2df (diff)
In clean() verify local branch existence before offering to remove it.
Change-Id: I98c6c2025bdd7266db2ea60e69c735cc2602fcba
-rwxr-xr-xtcwg-release.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/tcwg-release.sh b/tcwg-release.sh
index 9cfc601..6a4bf95 100755
--- a/tcwg-release.sh
+++ b/tcwg-release.sh
@@ -153,9 +153,14 @@ clean() {
rm -rf $REL_DIR/git
fi
fi
- ask "${bold}May I remove the local branch named \"${local_branch}\" as part of the cleanup process [N/y] ?${NC}" user_ok
- if [ "$user_ok" = "y" ]; then
- git branch -D ${local_branch}
+
+ # check to see if the local_branch has been created.
+ git rev-parse --verify ${local_branch} &>/dev/null
+ if [ $? -eq 0 ]; then
+ ask "${bold}May I remove the local branch named \"${local_branch}\" as part of the cleanup process [N/y] ?${NC}" user_ok
+ if [ "$user_ok" = "y" ]; then
+ git branch -D ${local_branch}
+ fi
fi
# If there is a tag created/associated with this release then it should