Commit ccc3d14430859626a72750d9d29e6eefc7f413e8

Authored by Arash Rouhani
1 parent f71e897ffa

Stop saying "already on branch" for new sessions

Showing 2 changed files with 9 additions and 1 deletions Side-by-side Diff

... ... @@ -197,7 +197,11 @@ antigen-update () {
197 197  
198 198 # If its a specific branch that we want, checkout that branch.
199 199 if [[ $url == *\|* ]]; then
200   - Git checkout "${url#*|}"
  200 + local current_branch=${$(Git symbolic-ref HEAD)##refs/heads/}
  201 + local requested_branch="${url#*|}"
  202 + # Only do the checkout when we are not already on the branch
  203 + [[ $requested_branch != $current_branch ]] &&
  204 + Git checkout $requested_branch
201 205 fi
202 206  
203 207 if ! [[ -z $old_rev || $old_rev == $new_rev ]]; then
tests/branch-bundle.t
... ... @@ -25,6 +25,10 @@ Load plugin from b1.
25 25 $ hehe
26 26 hehe from b1
27 27  
  28 +Does not say 'Already on b1' on each session startup.
  29 +
  30 + $ antigen-bundle $PLUGIN_DIR --branch=b1
  31 +
28 32 Load plugin from master.
29 33  
30 34 $ antigen-bundle $PLUGIN_DIR