From 38b0b0409ee096eb1c12546f64097837e566e3ef Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Date: Wed, 25 Jul 2012 00:16:47 +0530 Subject: [PATCH] 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. --- antigen.zsh | 19 ++++++++++++++----- tests/cleanup.t | 2 +- tests/list.t | 8 ++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/antigen.zsh b/antigen.zsh index 6b49bfd..ad2ff1f 100644 --- a/antigen.zsh +++ b/antigen.zsh @@ -16,6 +16,7 @@ antigen-bundle () { local url="$ANTIGEN_DEFAULT_REPO_URL" local loc=/ local branch= + local no_local_clone=false local btype=plugin # Set spec values based on the positional arguments. @@ -62,13 +63,15 @@ antigen-bundle () { fi # Add it to the record. - _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype" + _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype $no_local_clone" - # Ensure a clone exists for this repo. - -antigen-ensure-repo "$url" + # Ensure a clone exists for this repo, if needed. + if ! [[ $url == /* && $no_local_clone == true ]]; then + -antigen-ensure-repo "$url" + fi # Load the plugin. - -antigen-load "$url" "$loc" "$btype" + -antigen-load "$url" "$loc" "$btype" "$no_local_clone" } @@ -201,9 +204,15 @@ antigen-update () { local url="$1" local loc="$2" local btype="$3" + local no_local_clone="$4" # The full location where the plugin is located. - local location="$(-antigen-get-clone-dir "$url")/$loc" + local location + if ! [[ $url == /* && $no_local_clone == true ]]; then + location="$(-antigen-get-clone-dir "$url")/$loc" + else + location="$url" + fi if [[ $btype == theme ]]; then diff --git a/tests/cleanup.t b/tests/cleanup.t index a5ceed2..8995aa7 100644 --- a/tests/cleanup.t +++ b/tests/cleanup.t @@ -7,7 +7,7 @@ Load a plugin. Check the listing. $ antigen-list - */test-plugin / plugin (glob) + */test-plugin / plugin false (glob) Clear out the bundles record. diff --git a/tests/list.t b/tests/list.t index 3bcabac..08895bb 100644 --- a/tests/list.t +++ b/tests/list.t @@ -10,13 +10,13 @@ Add a bundle. Cloning into '.+?'\.\.\. (re) done. $ antigen-list - .*?/test-plugin / plugin (re) + */test-plugin / plugin false (glob) Add same bundle and check uniqueness. $ antigen-bundle $PLUGIN_DIR $ antigen-list - .*?/test-plugin / plugin (re) + */test-plugin / plugin false (glob) Add another bundle. @@ -24,5 +24,5 @@ Add another bundle. Cloning into '.+?'\.\.\. (re) done. $ antigen-list - .*?/test-plugin / plugin (re) - .*?/test-plugin2 / plugin (re) + */test-plugin / plugin false (glob) + */test-plugin2 / plugin false (glob) -- 2.0.0