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 Inline Diff

1 #!/bin/zsh 1 #!/bin/zsh
2 2
3 # Each line in this string has the following entries separated by a space 3 # Each line in this string has the following entries separated by a space
4 # character. 4 # character.
5 # <repo-url>, <plugin-location>, <bundle-type> 5 # <repo-url>, <plugin-location>, <bundle-type>
6 # FIXME: Is not kept local by zsh! 6 # FIXME: Is not kept local by zsh!
7 local _ANTIGEN_BUNDLE_RECORD="" 7 local _ANTIGEN_BUNDLE_RECORD=""
8 8
9 # Syntaxes 9 # Syntaxes
10 # antigen-bundle <url> [<loc>=/] 10 # antigen-bundle <url> [<loc>=/]
11 # Keyword only arguments: 11 # Keyword only arguments:
12 # branch - The branch of the repo to use for this bundle. 12 # branch - The branch of the repo to use for this bundle.
13 antigen-bundle () { 13 antigen-bundle () {
14 14
15 # Bundle spec arguments' default values. 15 # Bundle spec arguments' default values.
16 local url="$ANTIGEN_DEFAULT_REPO_URL" 16 local url="$ANTIGEN_DEFAULT_REPO_URL"
17 local loc=/ 17 local loc=/
18 local branch= 18 local branch=
19 local no_local_clone=false 19 local no_local_clone=false
20 local btype=plugin 20 local btype=plugin
21 21
22 # Set spec values based on the positional arguments. 22 # Set spec values based on the positional arguments.
23 local position_args 23 local position_args
24 position_args=(url loc) 24 position_args=(url loc)
25 local i=1 25 local i=1
26 while ! [[ -z $1 || $1 == --* ]]; do 26 while ! [[ -z $1 || $1 == --* ]]; do
27 local arg_name="${position_args[$i]}" 27 local arg_name="${position_args[$i]}"
28 local arg_value="$1" 28 local arg_value="$1"
29 eval "local $arg_name='$arg_value'" 29 eval "local $arg_name='$arg_value'"
30 shift 30 shift
31 i=$(($i + 1)) 31 i=$(($i + 1))
32 done 32 done
33 33
34 # Set spec values from keyword arguments, if any. The remaining arguments 34 # Set spec values from keyword arguments, if any. The remaining arguments
35 # are all assumed to be keyword arguments. 35 # are all assumed to be keyword arguments.
36 while [[ $1 == --* ]]; do 36 while [[ $1 == --* ]]; do
37 # Remove the `--` at the start. 37 # Remove the `--` at the start.
38 local arg="${1#--}" 38 local arg="${1#--}"
39 39
40 if [[ $arg != *=* ]]; then 40 if [[ $arg != *=* ]]; then
41 arg="$arg=true" 41 arg="$arg=true"
42 fi 42 fi
43 43
44 # Get the name of the arg and replace the `-`'s to `_`'s. 44 # Get the name of the arg and replace the `-`'s to `_`'s.
45 local arg_name="${${arg%\=*}//-/_}" 45 local arg_name="${${arg%\=*}//-/_}"
46 46
47 # Get the value of the arg. 47 # Get the value of the arg.
48 local arg_value="${arg#*\=}" 48 local arg_value="${arg#*\=}"
49 49
50 eval "local $arg_name='$arg_value'" 50 eval "local $arg_name='$arg_value'"
51 shift 51 shift
52 done 52 done
53 53
54 # Check if url is just the plugin name. Super short syntax. 54 # Check if url is just the plugin name. Super short syntax.
55 if [[ "$url" != */* ]]; then 55 if [[ "$url" != */* ]]; then
56 loc="plugins/$url" 56 loc="plugins/$url"
57 url="$ANTIGEN_DEFAULT_REPO_URL" 57 url="$ANTIGEN_DEFAULT_REPO_URL"
58 fi 58 fi
59 59
60 # Resolve the url. 60 # Resolve the url.
61 url="$(-antigen-resolve-bundle-url "$url")" 61 url="$(-antigen-resolve-bundle-url "$url")"
62 62
63 # Add the branch information to the url. 63 # Add the branch information to the url.
64 if [[ ! -z $branch ]]; then 64 if [[ ! -z $branch ]]; then
65 url="$url|$branch" 65 url="$url|$branch"
66 fi 66 fi
67 67
68 # The `make_local_clone` variable better represents whether there should be 68 # The `make_local_clone` variable better represents whether there should be
69 # a local clone made. For cloning to be avoided, firstly, the `$url` should 69 # a local clone made. For cloning to be avoided, firstly, the `$url` should
70 # be an absolute local path and `$branch` should be empty. In addition to 70 # be an absolute local path and `$branch` should be empty. In addition to
71 # these two conditions, either the `--no-local-clone` option should be 71 # these two conditions, either the `--no-local-clone` option should be
72 # given, or `$url` should not a git repo. 72 # given, or `$url` should not a git repo.
73 local make_local_clone=true 73 local make_local_clone=true
74 if [[ $url == /* && -z $branch \ 74 if [[ $url == /* && -z $branch \
75 && ( $no_local_clone == true || ! -d $url/.git ) ]]; then 75 && ( $no_local_clone == true || ! -d $url/.git ) ]]; then
76 make_local_clone=false 76 make_local_clone=false
77 fi 77 fi
78 78
79 # Add it to the record. 79 # Add it to the record.
80 _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype $make_local_clone" 80 _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype $make_local_clone"
81 81
82 # Ensure a clone exists for this repo, if needed. 82 # Ensure a clone exists for this repo, if needed.
83 if $make_local_clone; then 83 if $make_local_clone; then
84 -antigen-ensure-repo "$url" 84 -antigen-ensure-repo "$url"
85 fi 85 fi
86 86
87 # Load the plugin. 87 # Load the plugin.
88 -antigen-load "$url" "$loc" "$btype" "$make_local_clone" 88 -antigen-load "$url" "$loc" "$btype" "$make_local_clone"
89 89
90 } 90 }
91 91
92 -antigen-resolve-bundle-url () { 92 -antigen-resolve-bundle-url () {
93 # Given an acceptable short/full form of a bundle's repo url, this function 93 # Given an acceptable short/full form of a bundle's repo url, this function
94 # echoes the full form of the repo's clone url. 94 # echoes the full form of the repo's clone url.
95 95
96 local url="$1" 96 local url="$1"
97 97
98 # Expand short github url syntax: `username/reponame` 98 # Expand short github url syntax: `username/reponame`
99 if [[ $url != git://* && \ 99 if [[ $url != git://* && \
100 $url != https://* && \ 100 $url != https://* && \
101 $url != /* && \ 101 $url != /* && \
102 $url != git@github.com:*/* 102 $url != git@github.com:*/*
103 ]]; then 103 ]]; then
104 url="https://github.com/${url%.git}.git" 104 url="https://github.com/${url%.git}.git"
105 fi 105 fi
106 106
107 echo "$url" 107 echo "$url"
108 } 108 }
109 109
110 antigen-bundles () { 110 antigen-bundles () {
111 # Bulk add many bundles at one go. Empty lines and lines starting with a `#` 111 # Bulk add many bundles at one go. Empty lines and lines starting with a `#`
112 # are ignored. Everything else is given to `antigen-bundle` as is, no 112 # are ignored. Everything else is given to `antigen-bundle` as is, no
113 # quoting rules applied. 113 # quoting rules applied.
114 114
115 local line 115 local line
116 116
117 grep -v '^\s*$\|^#' | while read line; do 117 grep -v '^\s*$\|^#' | while read line; do
118 # Using `eval` so that we can use the shell-style quoting in each line 118 # Using `eval` so that we can use the shell-style quoting in each line
119 # piped to `antigen-bundles`. 119 # piped to `antigen-bundles`.
120 eval "antigen-bundle $line" 120 eval "antigen-bundle $line"
121 done 121 done
122 } 122 }
123 123
124 antigen-update () { 124 antigen-update () {
125 # Update your bundles, i.e., `git pull` in all the plugin repos. 125 # Update your bundles, i.e., `git pull` in all the plugin repos.
126 -antigen-echo-record \ 126 -antigen-echo-record \
127 | awk '{print $1}' \ 127 | awk '{print $1}' \
128 | sort -u \ 128 | sort -u \
129 | while read url; do 129 | while read url; do
130 echo "**** Pulling $url" 130 echo "**** Pulling $url"
131 -antigen-ensure-repo --update --verbose "$url" 131 -antigen-ensure-repo --update --verbose "$url"
132 echo 132 echo
133 done 133 done
134 } 134 }
135 135
136 -antigen-get-clone-dir () { 136 -antigen-get-clone-dir () {
137 # Takes a repo url and gives out the path that this url needs to be cloned 137 # Takes a repo url and gives out the path that this url needs to be cloned
138 # to. Doesn't actually clone anything. 138 # to. Doesn't actually clone anything.
139 # TODO: Memoize? 139 # TODO: Memoize?
140 140
141 # The url given. 141 # The url given.
142 local url="$1" 142 local url="$1"
143 143
144 # Echo the full path to the clone directory. 144 # Echo the full path to the clone directory.
145 echo -n $ADOTDIR/repos/ 145 echo -n $ADOTDIR/repos/
146 echo "$url" | sed \ 146 echo "$url" | sed \
147 -e 's./.-SLASH-.g' \ 147 -e 's./.-SLASH-.g' \
148 -e 's.:.-COLON-.g' \ 148 -e 's.:.-COLON-.g' \
149 -e 's.|.-PIPE-.g' 149 -e 's.|.-PIPE-.g'
150 } 150 }
151 151
152 -antigen-get-clone-url () { 152 -antigen-get-clone-url () {
153 # Takes a repo's clone dir and gives out the repo's original url that was 153 # Takes a repo's clone dir and gives out the repo's original url that was
154 # used to create the given directory path. 154 # used to create the given directory path.
155 # TODO: Memoize? 155 # TODO: Memoize?
156 echo "$1" | sed \ 156 echo "$1" | sed \
157 -e "s:^$ADOTDIR/repos/::" \ 157 -e "s:^$ADOTDIR/repos/::" \
158 -e 's.-SLASH-./.g' \ 158 -e 's.-SLASH-./.g' \
159 -e 's.-COLON-.:.g' \ 159 -e 's.-COLON-.:.g' \
160 -e 's.-PIPE-.|.g' 160 -e 's.-PIPE-.|.g'
161 } 161 }
162 162
163 -antigen-ensure-repo () { 163 -antigen-ensure-repo () {
164 164
165 # Ensure that a clone exists for the given repo url and branch. If the first 165 # Ensure that a clone exists for the given repo url and branch. If the first
166 # argument is `--update` and if a clone already exists for the given repo 166 # argument is `--update` and if a clone already exists for the given repo
167 # and branch, it is pull-ed, i.e., updated. 167 # and branch, it is pull-ed, i.e., updated.
168 168
169 # Argument defaults. 169 # Argument defaults.
170 # Check if we have to update. 170 # Check if we have to update.
171 local update=false 171 local update=false
172 # Verbose output. 172 # Verbose output.
173 local verbose=false 173 local verbose=false
174 174
175 # Load any boolean arguments specified. 175 # Load any boolean arguments specified.
176 while [[ $1 == --* ]]; do 176 while [[ $1 == --* ]]; do
177 eval "local '${1#--}=true'" 177 eval "local '${1#--}=true'"
178 shift 178 shift
179 done 179 done
180 180
181 # Get the clone's directory as per the given repo url and branch. 181 # Get the clone's directory as per the given repo url and branch.
182 local url="$1" 182 local url="$1"
183 local clone_dir="$(-antigen-get-clone-dir $url)" 183 local clone_dir="$(-antigen-get-clone-dir $url)"
184 Git () { eval git --git-dir=$clone_dir/.git --work-tree=$clone_dir "$@" } 184 Git () { eval git --git-dir=$clone_dir/.git --work-tree=$clone_dir "$@" }
185 185
186 # Clone if it doesn't already exist. 186 # Clone if it doesn't already exist.
187 if [[ ! -d $clone_dir ]]; then 187 if [[ ! -d $clone_dir ]]; then
188 git clone "${url%|*}" "$clone_dir" 188 git clone "${url%|*}" "$clone_dir"
189 elif $update; then 189 elif $update; then
190 # Save current revision. 190 # Save current revision.
191 old_rev="$(Git rev-parse HEAD)" 191 old_rev="$(Git rev-parse HEAD)"
192 # Pull changes if update requested. 192 # Pull changes if update requested.
193 Git pull 193 Git pull
194 # Get the new revision. 194 # Get the new revision.
195 new_rev="$(Git rev-parse HEAD)" 195 new_rev="$(Git rev-parse HEAD)"
196 fi 196 fi
197 197
198 # If its a specific branch that we want, checkout that branch. 198 # If its a specific branch that we want, checkout that branch.
199 if [[ $url == *\|* ]]; then 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 fi 205 fi
202 206
203 if ! [[ -z $old_rev || $old_rev == $new_rev ]]; then 207 if ! [[ -z $old_rev || $old_rev == $new_rev ]]; then
204 echo Updated from ${old_rev:0:7} to ${new_rev:0:7}. 208 echo Updated from ${old_rev:0:7} to ${new_rev:0:7}.
205 if $verbose; then 209 if $verbose; then
206 Git log --oneline --reverse --no-merges --stat '@{1}..' 210 Git log --oneline --reverse --no-merges --stat '@{1}..'
207 fi 211 fi
208 fi 212 fi
209 213
210 } 214 }
211 215
212 -antigen-load () { 216 -antigen-load () {
213 217
214 local url="$1" 218 local url="$1"
215 local loc="$2" 219 local loc="$2"
216 local btype="$3" 220 local btype="$3"
217 local make_local_clone="$4" 221 local make_local_clone="$4"
218 222
219 # The full location where the plugin is located. 223 # The full location where the plugin is located.
220 local location 224 local location
221 if $make_local_clone; then 225 if $make_local_clone; then
222 location="$(-antigen-get-clone-dir "$url")/$loc" 226 location="$(-antigen-get-clone-dir "$url")/$loc"
223 else 227 else
224 location="$url" 228 location="$url"
225 fi 229 fi
226 230
227 if [[ $btype == theme ]]; then 231 if [[ $btype == theme ]]; then
228 232
229 # Of course, if its a theme, the location would point to the script 233 # Of course, if its a theme, the location would point to the script
230 # file. 234 # file.
231 source "$location" 235 source "$location"
232 236
233 else 237 else
234 238
235 # Source the plugin script 239 # Source the plugin script
236 # FIXME: I don't know. Looks very very ugly. Needs a better 240 # FIXME: I don't know. Looks very very ugly. Needs a better
237 # implementation once tests are ready. 241 # implementation once tests are ready.
238 local script_loc="$(ls "$location" | grep -m1 '\.plugin\.zsh$')" 242 local script_loc="$(ls "$location" | grep -m1 '\.plugin\.zsh$')"
239 243
240 if [[ -f $script_loc ]]; then 244 if [[ -f $script_loc ]]; then
241 # If we have a `*.plugin.zsh`, source it. 245 # If we have a `*.plugin.zsh`, source it.
242 source "$script_loc" 246 source "$script_loc"
243 247
244 elif [[ ! -z "$(ls "$location" | grep -m1 '\.zsh$')" ]]; then 248 elif [[ ! -z "$(ls "$location" | grep -m1 '\.zsh$')" ]]; then
245 # If there is no `*.plugin.zsh` file, source *all* the `*.zsh` 249 # If there is no `*.plugin.zsh` file, source *all* the `*.zsh`
246 # files. 250 # files.
247 for script ($location/*.zsh(N)) source "$script" 251 for script ($location/*.zsh(N)) source "$script"
248 252
249 elif [[ ! -z "$(ls "$location" | grep -m1 '\.sh$')" ]]; then 253 elif [[ ! -z "$(ls "$location" | grep -m1 '\.sh$')" ]]; then
250 # If there are no `*.zsh` files either, we look for and source any 254 # If there are no `*.zsh` files either, we look for and source any
251 # `*.sh` files instead. 255 # `*.sh` files instead.
252 for script ($location/*.sh(N)) source "$script" 256 for script ($location/*.sh(N)) source "$script"
253 257
254 fi 258 fi
255 259
256 # Add to $fpath, for completion(s). 260 # Add to $fpath, for completion(s).
257 fpath=($location $fpath) 261 fpath=($location $fpath)
258 262
259 fi 263 fi
260 264
261 } 265 }
262 266
263 antigen-cleanup () { 267 antigen-cleanup () {
264 268
265 # Cleanup unused repositories. 269 # Cleanup unused repositories.
266 270
267 local force=false 271 local force=false
268 if [[ $1 == --force ]]; then 272 if [[ $1 == --force ]]; then
269 force=true 273 force=true
270 fi 274 fi
271 275
272 if [[ ! -d "$ADOTDIR/repos" || -z "$(ls "$ADOTDIR/repos/")" ]]; then 276 if [[ ! -d "$ADOTDIR/repos" || -z "$(ls "$ADOTDIR/repos/")" ]]; then
273 echo "You don't have any bundles." 277 echo "You don't have any bundles."
274 return 0 278 return 0
275 fi 279 fi
276 280
277 # Find directores in ADOTDIR/repos, that are not in the bundles record. 281 # Find directores in ADOTDIR/repos, that are not in the bundles record.
278 local unused_clones="$(comm -13 \ 282 local unused_clones="$(comm -13 \
279 <(-antigen-echo-record \ 283 <(-antigen-echo-record \
280 | awk '$4 == "true" {print $1}' \ 284 | awk '$4 == "true" {print $1}' \
281 | while read line; do 285 | while read line; do
282 -antigen-get-clone-dir "$line" 286 -antigen-get-clone-dir "$line"
283 done \ 287 done \
284 | sort -u) \ 288 | sort -u) \
285 <(ls -d "$ADOTDIR/repos/"* | sort -u))" 289 <(ls -d "$ADOTDIR/repos/"* | sort -u))"
286 290
287 if [[ -z $unused_clones ]]; then 291 if [[ -z $unused_clones ]]; then
288 echo "You don't have any unidentified bundles." 292 echo "You don't have any unidentified bundles."
289 return 0 293 return 0
290 fi 294 fi
291 295
292 echo 'You have clones for the following repos, but are not used.' 296 echo 'You have clones for the following repos, but are not used.'
293 echo "$unused_clones" \ 297 echo "$unused_clones" \
294 | while read line; do 298 | while read line; do
295 -antigen-get-clone-url "$line" 299 -antigen-get-clone-url "$line"
296 done \ 300 done \
297 | sed -e 's/^/ /' -e 's/|/, branch /' 301 | sed -e 's/^/ /' -e 's/|/, branch /'
298 302
299 if $force || (echo -n '\nDelete them all? [y/N] '; read -q); then 303 if $force || (echo -n '\nDelete them all? [y/N] '; read -q); then
300 echo 304 echo
301 echo 305 echo
302 echo "$unused_clones" | while read line; do 306 echo "$unused_clones" | while read line; do
303 echo -n "Deleting clone for $(-antigen-get-clone-url "$line")..." 307 echo -n "Deleting clone for $(-antigen-get-clone-url "$line")..."
304 rm -rf "$line" 308 rm -rf "$line"
305 echo ' done.' 309 echo ' done.'
306 done 310 done
307 else 311 else
308 echo 312 echo
309 echo Nothing deleted. 313 echo Nothing deleted.
310 fi 314 fi
311 } 315 }
312 316
313 antigen-lib () { 317 antigen-lib () {
314 antigen-bundle --loc=lib 318 antigen-bundle --loc=lib
315 } 319 }
316 320
317 antigen-theme () { 321 antigen-theme () {
318 local name="${1:-robbyrussell}" 322 local name="${1:-robbyrussell}"
319 antigen-bundle --loc=themes/$name.zsh-theme --btype=theme 323 antigen-bundle --loc=themes/$name.zsh-theme --btype=theme
320 } 324 }
321 325
322 antigen-apply () { 326 antigen-apply () {
323 # Initialize completion. 327 # Initialize completion.
324 # TODO: Only load completions if there are any changes to the bundle 328 # TODO: Only load completions if there are any changes to the bundle
325 # repositories. 329 # repositories.
326 compinit -i 330 compinit -i
327 } 331 }
328 332
329 antigen-list () { 333 antigen-list () {
330 # List all currently installed bundles 334 # List all currently installed bundles
331 if [[ -z "$_ANTIGEN_BUNDLE_RECORD" ]]; then 335 if [[ -z "$_ANTIGEN_BUNDLE_RECORD" ]]; then
332 echo "You don't have any bundles." >&2 336 echo "You don't have any bundles." >&2
333 return 1 337 return 1
334 else 338 else
335 -antigen-echo-record | sort -u 339 -antigen-echo-record | sort -u
336 fi 340 fi
337 } 341 }
338 342
339 antigen-help () { 343 antigen-help () {
340 cat <<EOF 344 cat <<EOF
341 Antigen is a plugin management system for zsh. It makes it easy to grab awesome 345 Antigen is a plugin management system for zsh. It makes it easy to grab awesome
342 shell scripts and utilities, put up on github. For further details and complete 346 shell scripts and utilities, put up on github. For further details and complete
343 documentation, visit the project's page at 'http://antigen.sharats.me'. 347 documentation, visit the project's page at 'http://antigen.sharats.me'.
344 EOF 348 EOF
345 } 349 }
346 350
347 # A syntax sugar to avoid the `-` when calling antigen commands. With this 351 # A syntax sugar to avoid the `-` when calling antigen commands. With this
348 # function, you can write `antigen-bundle` as `antigen bundle` and so on. 352 # function, you can write `antigen-bundle` as `antigen bundle` and so on.
349 antigen () { 353 antigen () {
350 local cmd="$1" 354 local cmd="$1"
351 shift 355 shift
352 "antigen-$cmd" "$@" 356 "antigen-$cmd" "$@"
353 } 357 }
354 358
355 # Echo the bundle specs as in the record. The first line is not echoed since it 359 # Echo the bundle specs as in the record. The first line is not echoed since it
356 # is a blank line. 360 # is a blank line.
357 -antigen-echo-record () { 361 -antigen-echo-record () {
358 echo "$_ANTIGEN_BUNDLE_RECORD" | sed -n '1!p' 362 echo "$_ANTIGEN_BUNDLE_RECORD" | sed -n '1!p'
359 } 363 }
360 364
361 -antigen-env-setup () { 365 -antigen-env-setup () {
362 # Pre-startup initializations 366 # Pre-startup initializations
363 -set-default ANTIGEN_DEFAULT_REPO_URL \ 367 -set-default ANTIGEN_DEFAULT_REPO_URL \
364 https://github.com/robbyrussell/oh-my-zsh.git 368 https://github.com/robbyrussell/oh-my-zsh.git
365 -set-default ADOTDIR $HOME/.antigen 369 -set-default ADOTDIR $HOME/.antigen
366 370
367 # Load the compinit module 371 # Load the compinit module
368 autoload -U compinit 372 autoload -U compinit
369 373
370 # Without the following, `compdef` function is not defined. 374 # Without the following, `compdef` function is not defined.
371 compinit -i 375 compinit -i
372 } 376 }
373 377
374 # Same as `export $1=$2`, but will only happen if the name specified by `$1` is 378 # Same as `export $1=$2`, but will only happen if the name specified by `$1` is
375 # not already set. 379 # not already set.
376 -set-default () { 380 -set-default () {
377 local arg_name="$1" 381 local arg_name="$1"
378 local arg_value="$2" 382 local arg_value="$2"
379 eval "test -z \"\$$arg_name\" && export $arg_name='$arg_value'" 383 eval "test -z \"\$$arg_name\" && export $arg_name='$arg_value'"
380 } 384 }
381 385
382 -antigen-env-setup 386 -antigen-env-setup
383 387
tests/branch-bundle.t
1 Branch b1. 1 Branch b1.
2 2
3 $ pg branch b1 3 $ pg branch b1
4 $ pg checkout b1 4 $ pg checkout b1
5 Switched to branch 'b1' 5 Switched to branch 'b1'
6 $ cat > $PLUGIN_DIR/aliases.zsh <<EOF 6 $ cat > $PLUGIN_DIR/aliases.zsh <<EOF
7 > alias hehe='echo hehe from b1' 7 > alias hehe='echo hehe from b1'
8 > EOF 8 > EOF
9 $ pg commit -am 'Change for b1' 9 $ pg commit -am 'Change for b1'
10 \[b1 [a-f0-9]{7}\] Change for b1 (re) 10 \[b1 [a-f0-9]{7}\] Change for b1 (re)
11 1 file changed, 1 insertion(+), 1 deletion(-) 11 1 file changed, 1 insertion(+), 1 deletion(-)
12 12
13 Go back to master. 13 Go back to master.
14 14
15 $ pg checkout master 15 $ pg checkout master
16 Switched to branch 'master' 16 Switched to branch 'master'
17 17
18 Load plugin from b1. 18 Load plugin from b1.
19 19
20 $ antigen-bundle $PLUGIN_DIR --branch=b1 20 $ antigen-bundle $PLUGIN_DIR --branch=b1
21 Cloning into '.+?'\.\.\. (re) 21 Cloning into '.+?'\.\.\. (re)
22 done. 22 done.
23 Switched to a new branch 'b1' 23 Switched to a new branch 'b1'
24 Branch b1 set up to track remote branch b1 from origin. 24 Branch b1 set up to track remote branch b1 from origin.
25 $ hehe 25 $ hehe
26 hehe from b1 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 Load plugin from master. 32 Load plugin from master.
29 33
30 $ antigen-bundle $PLUGIN_DIR 34 $ antigen-bundle $PLUGIN_DIR
31 Cloning into '.+?'\.\.\. (re) 35 Cloning into '.+?'\.\.\. (re)
32 done. 36 done.
33 $ hehe 37 $ hehe
34 hehe 38 hehe
35 39