From 378b1ebb25bf8420e66635c65300ecb114e310da Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Sun, 26 Apr 2015 13:34:54 +0200 Subject: [PATCH] Update previous commit: short-circuit --- git-stree | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/git-stree b/git-stree index 317f5e0..4fdb099 100755 --- a/git-stree +++ b/git-stree @@ -143,18 +143,17 @@ function error # Command: `git stree forget` function forget_subtrees { - if [ -z "${args[1]}" ]; then - for name in $(get_subtree_list simple); do - rm_subtree "$name" && discreet "• Removed subtree '$name'" - done - yay 'Successfully removed all subtree definitions.' - else - error false "This is not the command you're looking for. -git stree forget removes all subtrees defined for this repository. -You specified a specific subtree ($1) on the command line, -so you probably want: git stree rm $1 -" + if [ -n "${args[1]}" ]; then + error false "This is not the command you're looking for. + git stree forget removes all subtrees defined for this repository. + You specified a specific subtree ($1) on the command line, + so you probably want: git stree rm $1 + " fi + for name in $(get_subtree_list simple); do + rm_subtree "$name" && discreet "• Removed subtree '$name'" + done + yay 'Successfully removed all subtree definitions.' } # Helper: computes a backport branch name based on the passed CLI name.