Commit 38b0b0409ee096eb1c12546f64097837e566e3ef
1 parent
d2137eade1
Fix #12. Local bundles can now bypass cloning.
The new `--no-local-clone` argument to -bundle command makes it so that if the bundle specified is a local path, then no new clone is made. The bundle is loaded directly from the given path.
Showing 3 changed files with 19 additions and 10 deletions Side-by-side Diff
antigen.zsh
| ... | ... | @@ -16,6 +16,7 @@ antigen-bundle () { |
| 16 | 16 | local url="$ANTIGEN_DEFAULT_REPO_URL" |
| 17 | 17 | local loc=/ |
| 18 | 18 | local branch= |
| 19 | + local no_local_clone=false | |
| 19 | 20 | local btype=plugin |
| 20 | 21 | |
| 21 | 22 | # Set spec values based on the positional arguments. |
| ... | ... | @@ -62,13 +63,15 @@ antigen-bundle () { |
| 62 | 63 | fi |
| 63 | 64 | |
| 64 | 65 | # Add it to the record. |
| 65 | - _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype" | |
| 66 | + _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype $no_local_clone" | |
| 66 | 67 | |
| 67 | - # Ensure a clone exists for this repo. | |
| 68 | - -antigen-ensure-repo "$url" | |
| 68 | + # Ensure a clone exists for this repo, if needed. | |
| 69 | + if ! [[ $url == /* && $no_local_clone == true ]]; then | |
| 70 | + -antigen-ensure-repo "$url" | |
| 71 | + fi | |
| 69 | 72 | |
| 70 | 73 | # Load the plugin. |
| 71 | - -antigen-load "$url" "$loc" "$btype" | |
| 74 | + -antigen-load "$url" "$loc" "$btype" "$no_local_clone" | |
| 72 | 75 | |
| 73 | 76 | } |
| 74 | 77 | |
| ... | ... | @@ -201,9 +204,15 @@ antigen-update () { |
| 201 | 204 | local url="$1" |
| 202 | 205 | local loc="$2" |
| 203 | 206 | local btype="$3" |
| 207 | + local no_local_clone="$4" | |
| 204 | 208 | |
| 205 | 209 | # The full location where the plugin is located. |
| 206 | - local location="$(-antigen-get-clone-dir "$url")/$loc" | |
| 210 | + local location | |
| 211 | + if ! [[ $url == /* && $no_local_clone == true ]]; then | |
| 212 | + location="$(-antigen-get-clone-dir "$url")/$loc" | |
| 213 | + else | |
| 214 | + location="$url" | |
| 215 | + fi | |
| 207 | 216 | |
| 208 | 217 | if [[ $btype == theme ]]; then |
| 209 | 218 |
tests/cleanup.t
tests/list.t
| ... | ... | @@ -10,13 +10,13 @@ Add a bundle. |
| 10 | 10 | Cloning into '.+?'\.\.\. (re) |
| 11 | 11 | done. |
| 12 | 12 | $ antigen-list |
| 13 | - .*?/test-plugin / plugin (re) | |
| 13 | + */test-plugin / plugin false (glob) | |
| 14 | 14 | |
| 15 | 15 | Add same bundle and check uniqueness. |
| 16 | 16 | |
| 17 | 17 | $ antigen-bundle $PLUGIN_DIR |
| 18 | 18 | $ antigen-list |
| 19 | - .*?/test-plugin / plugin (re) | |
| 19 | + */test-plugin / plugin false (glob) | |
| 20 | 20 | |
| 21 | 21 | Add another bundle. |
| 22 | 22 | |
| ... | ... | @@ -24,5 +24,5 @@ Add another bundle. |
| 24 | 24 | Cloning into '.+?'\.\.\. (re) |
| 25 | 25 | done. |
| 26 | 26 | $ antigen-list |
| 27 | - .*?/test-plugin / plugin (re) | |
| 28 | - .*?/test-plugin2 / plugin (re) | |
| 27 | + */test-plugin / plugin false (glob) | |
| 28 | + */test-plugin2 / plugin false (glob) |