From 41abcf6628756f0d04fce4ec3337820d71357a10 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Date: Thu, 26 Jul 2012 20:03:41 +0530 Subject: [PATCH] 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. --- antigen.zsh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/antigen.zsh b/antigen.zsh index 8b91b9b..d83cd81 100644 --- a/antigen.zsh +++ b/antigen.zsh @@ -65,16 +65,24 @@ antigen-bundle () { url="$url|$branch" fi + # The `make_local_clone` variable better represents whether there should be + # a local clone made. If the url is a local absolute path and no_local_clone + # is true, then and only then, there should be no cloning taking place. + local make_local_clone=true + if [[ $url == /* && $no_local_clone == true ]]; then + make_local_clone=false + fi + # Add it to the record. - _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype $no_local_clone" + _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype $make_local_clone" # Ensure a clone exists for this repo, if needed. - if ! [[ $url == /* && $no_local_clone == true ]]; then + if $make_local_clone; then -antigen-ensure-repo "$url" fi # Load the plugin. - -antigen-load "$url" "$loc" "$btype" "$no_local_clone" + -antigen-load "$url" "$loc" "$btype" "$make_local_clone" } @@ -207,11 +215,11 @@ antigen-update () { local url="$1" local loc="$2" local btype="$3" - local no_local_clone="$4" + local make_local_clone="$4" # The full location where the plugin is located. local location - if ! [[ $url == /* && $no_local_clone == true ]]; then + if $make_local_clone; then location="$(-antigen-get-clone-dir "$url")/$loc" else location="$url" -- 2.0.0