From 9114048dede7a8e9e76a32bb7fe407eba02f66a4 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 20 Feb 2018 23:24:35 +0100 Subject: 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. --- git-branch-list | 5 +++++ 1 file changed, 5 insertions(+) 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" } -- cgit v1.2.3