MarcWeber / vim-addon-manager

manage and install vim plugins (including their dependencies) in a sane way. If you have any trouble contact me. Usually I reply within 24 hours
Other
660 stars 59 forks source link

[patch] git version detection for shallow repos #50

Closed jolan78 closed 12 years ago

jolan78 commented 12 years ago

hello. here is a patch which disable git's shallow clones if git is too old (shallow clone was added in 1.5.0) the code may not follow your coding standards , feel free to rework it.

From 0f8c1f27d352077de807acdd266df21e01295065 Mon Sep 17 00:00:00 2001 From: jolan78 spam00fr@yahoo.fr Date: Tue, 13 Sep 2011 14:45:08 +0200 Subject: [PATCH] git version detection for shallow repos


autoload/vcs_checkouts.vim | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/autoload/vcs_checkouts.vim b/autoload/vcs_checkouts.vim index 61930c6..41c1552 100644 --- a/autoload/vcs_checkouts.vim +++ b/autoload/vcs_checkouts.vim @@ -2,7 +2,25 @@ " its very short probably VAM will keep a copy

exec vam#DefineAndBind('s:c','g:vim_addon_manager','{}') -let s:c.shallow_clones = get(s:c,'shallow_clones',1) + +fun! vcs_checkouts#IsGitVersionGT(minrev)

MarcWeber commented 12 years ago

Excerpts from jolan78's message of Tue Sep 13 14:52:21 +0200 2011:

hello. here is a patch which disable git's shallow clones if git is too old (shallow clone was added in 1.5.0) the code may not follow your coding standards , feel free to rework it.

Looks fine to me in general.

However I'd prefer less code. What about let git_provides_depth = system('git clone --help') =~ '--depth' ?

Don't think we really need version comparison yet.

What happens if there is no git?

Marc Weber

jolan78 commented 12 years ago

sure, git clone --help would be fine. I didn't think about the absence of git. then : let git_provides_depth = executable('git') && system('git clone --help') =~ '--depth' would be do the trick

MarcWeber commented 12 years ago

please test b346438. Thanks for this improvement

jolan78 commented 12 years ago

it works great. thank you.