Commit e6cc15b5f558ba66c1aa44af4f557c8140c8234e

Authored by Shrikant Sharat
1 parent c46b6673e4

Fix local paths with branches not working.

Local bundles, if are recorded with a `--branch` option, should *always* be
cloned.

Showing 2 changed files with 12 additions and 7 deletions Side-by-side Diff

... ... @@ -203,7 +203,7 @@ You can also specify a local directory on your file system as a bundle. In this
203 203 case, make sure the path you give is the absolute path (i.e., starts with a
204 204 `/`). Relative paths are not supported. If the repo you gave is a local
205 205 directory path, then it is not necessary that this path is a git repo. Please
206   -refer to the notes on `--no-local-repo` below.
  206 +refer to the notes on `--no-local-clone` below.
207 207  
208 208 In addition to the above discussed arguments, `antigen-bundle` also takes a
209 209 `btype` keyword-only argument, that is used internally. You shouldn't be
... ... @@ -238,8 +238,10 @@ creating a clone. For example,
238 238  
239 239 antigen-bundle /absolute/path/to/the/plugin --no-local-clone
240 240  
241   -Note that if the repo url is *not* an absolute local path, this argument has no
242   -effect.
  241 +Note that if the repo url is *not* an absolute local path or a branch has been
  242 +specified with the `--branch` option, this argument has no effect. That is,
  243 +for this option to have any affect, the repo url must be an absolute local path
  244 +and no `--branch` should be specified.
243 245  
244 246 Also, if the local path given as the url is not a git repo, then this
245 247 argument is forced as it doesn't makes sense to *clone* something that's not a
... ... @@ -66,10 +66,13 @@ antigen-bundle () {
66 66 fi
67 67  
68 68 # The `make_local_clone` variable better represents whether there should be
69   - # a local clone made. If the url is a local absolute path and no_local_clone
70   - # is true, then and only then, there should be no cloning taking place.
  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
  71 + # these two conditions, either the `--no-local-clone` option should be
  72 + # given, or `$url` should not a git repo.
71 73 local make_local_clone=true
72   - if [[ $url == /* && ( $no_local_clone == true || ! -d $url/.git ) ]]; then
  74 + if [[ $url == /* && -z $branch \
  75 + && ( $no_local_clone == true || ! -d $url/.git ) ]]; then
73 76 make_local_clone=false
74 77 fi
75 78  
... ... @@ -82,7 +85,7 @@ antigen-bundle () {
82 85 fi
83 86  
84 87 # Load the plugin.
85   - -antigen-load "$url" "$loc" "$btype" "$make_local_clone"
  88 + -antigen-load "$url" "$loc" "$btype" "$make_local_clone"
86 89  
87 90 }
88 91