Commit 41abcf6628756f0d04fce4ec3337820d71357a10
1 parent
b43a3cf1f1
Simpler implementation of --no-local-clone.
Using a new `make_local_clone` variable which is an internal field that better represents whether we need a local clone.
Showing 1 changed file with 13 additions and 5 deletions Side-by-side Diff
antigen.zsh
... | ... | @@ -65,16 +65,24 @@ antigen-bundle () { |
65 | 65 | url="$url|$branch" |
66 | 66 | fi |
67 | 67 | |
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. | |
71 | + local make_local_clone=true | |
72 | + if [[ $url == /* && $no_local_clone == true ]]; then | |
73 | + make_local_clone=false | |
74 | + fi | |
75 | + | |
68 | 76 | # Add it to the record. |
69 | - _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype $no_local_clone" | |
77 | + _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype $make_local_clone" | |
70 | 78 | |
71 | 79 | # Ensure a clone exists for this repo, if needed. |
72 | - if ! [[ $url == /* && $no_local_clone == true ]]; then | |
80 | + if $make_local_clone; then | |
73 | 81 | -antigen-ensure-repo "$url" |
74 | 82 | fi |
75 | 83 | |
76 | 84 | # Load the plugin. |
77 | - -antigen-load "$url" "$loc" "$btype" "$no_local_clone" | |
85 | + -antigen-load "$url" "$loc" "$btype" "$make_local_clone" | |
78 | 86 | |
79 | 87 | } |
80 | 88 | |
... | ... | @@ -207,11 +215,11 @@ antigen-update () { |
207 | 215 | local url="$1" |
208 | 216 | local loc="$2" |
209 | 217 | local btype="$3" |
210 | - local no_local_clone="$4" | |
218 | + local make_local_clone="$4" | |
211 | 219 | |
212 | 220 | # The full location where the plugin is located. |
213 | 221 | local location |
214 | - if ! [[ $url == /* && $no_local_clone == true ]]; then | |
222 | + if $make_local_clone; then | |
215 | 223 | location="$(-antigen-get-clone-dir "$url")/$loc" |
216 | 224 | else |
217 | 225 | location="$url" |