aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-02-20 23:24:35 +0100
committerTeddy Wing2018-02-20 23:24:35 +0100
commit9114048dede7a8e9e76a32bb7fe407eba02f66a4 (patch)
tree2f279553b4edc322a8fd2b2ba8266711b89b3168
parented85526917c8b892c432be74c5fd60ceff4f3ba2 (diff)
downloadgit-branch-list-9114048dede7a8e9e76a32bb7fe407eba02f66a4.tar.bz2
git-branch-list(checkout_branch): Error if ID is invalid
If the given ID doesn't correspond to a branch in our database, we should exit with an error.
-rwxr-xr-xgit-branch-list5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-branch-list b/git-branch-list
index bf55624..c0e355c 100755
--- a/git-branch-list
+++ b/git-branch-list
@@ -56,6 +56,11 @@ function checkout_branch () {
fgrep "$id " |
cut -d ' ' -f 2)
+ if [ "$branch" = '' ]; then
+ echo 'branch-list: Invalid checkout ID' 1>&2
+ return 1
+ fi
+
git checkout "$branch"
}