Avoid errors
This commit is contained in:
parent
33cb99a27c
commit
fe0a986c84
10
plug.vim
10
plug.vim
|
@ -2231,8 +2231,7 @@ function! s:git_validate(spec, check_branch)
|
|||
\ 'Expected: '.a:spec.uri,
|
||||
\ 'PlugClean required.'], "\n")
|
||||
elseif a:check_branch && has_key(a:spec, 'commit')
|
||||
let result = [s:git_get_revision(a:spec.dir)]
|
||||
let sha = result[-1]
|
||||
let sha = [s:git_get_revision(a:spec.dir)]
|
||||
if !s:hash_match(sha, a:spec.commit)
|
||||
let err = join([printf('Invalid HEAD (expected: %s, actual: %s)',
|
||||
\ a:spec.commit[:6], sha[:6]),
|
||||
|
@ -2253,10 +2252,12 @@ function! s:git_validate(spec, check_branch)
|
|||
\ branch, a:spec.branch)
|
||||
endif
|
||||
if empty(err)
|
||||
let [ahead, behind] = split(s:lastline(s:system(printf(
|
||||
let result = split(s:lastline(s:system(printf(
|
||||
\ 'git rev-list --count --left-right HEAD...origin/%s',
|
||||
\ a:spec.branch), a:spec.dir)), '\t')
|
||||
if !v:shell_error && ahead
|
||||
if !v:shell_error && len(result) == 2
|
||||
let [ahead, behind] = result
|
||||
if ahead
|
||||
if behind
|
||||
" Only mention PlugClean if diverged, otherwise it's likely to be
|
||||
" pushable (and probably not that messed up).
|
||||
|
@ -2271,6 +2272,7 @@ function! s:git_validate(spec, check_branch)
|
|||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
let err = 'Not found'
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user