Skip to content

Commit 7dd874e

Browse files
committed
avoid error when string not have \t
1 parent 5b2a6e1 commit 7dd874e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plug.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,14 +2050,14 @@ function! s:git_validate(spec, check_branch)
20502050
let [output, shellerror] = s:system(printf(
20512051
\ 'git rev-list --count --left-right HEAD...origin/%s',
20522052
\ a:spec.branch), a:spec.dir)
2053-
let [ahead, behind] = split(s:lastline(output), '\t')
2054-
if !shellerror && ahead
2055-
if behind
2053+
let [ahead; behind] = split(s:lastline(output), '\t')
2054+
if !shellerror && ahead && len(behind) == 1
2055+
if behind[0]
20562056
" Only mention PlugClean if diverged, otherwise it's likely to be
20572057
" pushable (and probably not that messed up).
20582058
let err = printf(
20592059
\ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
2060-
\ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind)
2060+
\ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind[0])
20612061
else
20622062
let err = printf("Ahead of origin/%s by %d commit(s).\n"
20632063
\ .'Cannot update until local changes are pushed.',

0 commit comments

Comments
 (0)