From 27d0e061f660f98c8d245c87a65cb4341cd9a7c0 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Tue, 18 Sep 2012 15:22:29 -0300 Subject: [PATCH] Automatically set git push url when cloning repo --- autoload/vundle/installer.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index f7e4375..a199b4d 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -218,7 +218,10 @@ func! s:sync(bang, bundle) abort let get_current_sha = 'cd '.shellescape(a:bundle.path()).' && git rev-parse HEAD' let initial_sha = s:system(get_current_sha)[0:15] else - let cmd = 'git clone --recursive '.a:bundle.uri.' '.shellescape(a:bundle.path()) + let push_uri = substitute(a:bundle.uri, 'https://', 'git@', '') + let push_uri = substitute(push_uri, 'github.com/', 'github.com:', '') + let cmd = 'git clone --recursive '.a:bundle.uri.' '.shellescape(a:bundle.path()).' && '. + \ 'git --git-dir='.shellescape(a:bundle.path().'/.git').' remote set-url --push origin '.push_uri let initial_sha = '' endif