From ccc3d14430859626a72750d9d29e6eefc7f413e8 Mon Sep 17 00:00:00 2001 From: Arash Rouhani Date: Fri, 10 Aug 2012 13:04:10 +0200 Subject: [PATCH] Stop saying "already on branch" for new sessions --- antigen.zsh | 6 +++++- tests/branch-bundle.t | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/antigen.zsh b/antigen.zsh index 014a2db..b4d751d 100644 --- a/antigen.zsh +++ b/antigen.zsh @@ -197,7 +197,11 @@ antigen-update () { # If its a specific branch that we want, checkout that branch. if [[ $url == *\|* ]]; then - Git checkout "${url#*|}" + local current_branch=${$(Git symbolic-ref HEAD)##refs/heads/} + local requested_branch="${url#*|}" + # Only do the checkout when we are not already on the branch + [[ $requested_branch != $current_branch ]] && + Git checkout $requested_branch fi if ! [[ -z $old_rev || $old_rev == $new_rev ]]; then diff --git a/tests/branch-bundle.t b/tests/branch-bundle.t index 84e8193..82852dd 100644 --- a/tests/branch-bundle.t +++ b/tests/branch-bundle.t @@ -25,6 +25,10 @@ Load plugin from b1. $ hehe hehe from b1 +Does not say 'Already on b1' on each session startup. + + $ antigen-bundle $PLUGIN_DIR --branch=b1 + Load plugin from master. $ antigen-bundle $PLUGIN_DIR -- 2.0.0