From 7dd874e90ccafcbdd441b7424babb01373763d62 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Tue, 21 Feb 2017 18:55:55 +0900 Subject: [PATCH] avoid error when string not have \t --- plug.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plug.vim b/plug.vim index 157bfb5..3244403 100644 --- a/plug.vim +++ b/plug.vim @@ -2050,14 +2050,14 @@ function! s:git_validate(spec, check_branch) let [output, shellerror] = s:system(printf( \ 'git rev-list --count --left-right HEAD...origin/%s', \ a:spec.branch), a:spec.dir) - let [ahead, behind] = split(s:lastline(output), '\t') - if !shellerror && ahead - if behind + let [ahead; behind] = split(s:lastline(output), '\t') + if !shellerror && ahead && len(behind) == 1 + if behind[0] " Only mention PlugClean if diverged, otherwise it's likely to be " pushable (and probably not that messed up). let err = printf( \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" - \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind) + \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind[0]) else let err = printf("Ahead of origin/%s by %d commit(s).\n" \ .'Cannot update until local changes are pushed.',