Created
July 15, 2011 04:44
-
-
Save pocket7878/1084085 to your computer and use it in GitHub Desktop.
little change for syncj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func! s:sync(bang, bundle) abort | |
let git_dir = expand(a:bundle.path().'/.git/') | |
if isdirectory(git_dir) | |
if !(a:bang) | return 0 | endif | |
let cmd = 'git pull' | |
if (has('win32') || has('win64')) | |
"let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives | |
let cmd = '"'.cmd.'"' " enclose in quotes | |
endif | |
"cd to bundle path" | |
cd `=a:bundle.path()` | |
let l:result = s:system(cmd) | |
if l:result =~ "^Already up-to-date." | |
return 0 | |
else | |
return 1 | |
endif | |
else | |
let cmd = 'git clone '.a:bundle.uri.' '.a:bundle.path() | |
call s:system(cmd) | |
return 1 | |
endif | |
endf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment