Conversation
|
Thanks, it looks interesting. But there are places we refer to e.g. Also I wonder why bumping up |
|
I will add code for |
|
I think we should stop using |
|
yes, we have better to separate |
|
added |
| @@ -1979,34 +1982,70 @@ endfunction | |||
|
|
|||
| function! s:system(cmd, ...) | |||
There was a problem hiding this comment.
s:system can be simplified to s:system_with_error(...)[0].
plug.vim
Outdated
| \ a:spec.branch), a:spec.dir)), '\t') | ||
| if !v:shell_error && ahead | ||
| \ a:spec.branch), a:spec.dir) | ||
| let [ahead, behind] = split(s:lastline(output), '\t') |
There was a problem hiding this comment.
Hmm, this can fail if output does not have \t because of an error, right? It was my oversight.
plug.vim
Outdated
| let shellerror = 0 | ||
| if has_key(spec, 'commit') | ||
| call s:log4(name, 'Checking out '.spec.commit) | ||
| let out = s:checkout(spec) |
There was a problem hiding this comment.
s:checkout can fail. It used to set v:shell_error which is tested at line 1079, but now we have to update shellerror. The same goes for line 1072 and 1076.
plug.vim
Outdated
| \ a:spec.branch), a:spec.dir) | ||
| let [ahead; behind] = split(s:lastline(output), '\t') | ||
| if !shellerror && ahead | ||
| if len(behind) > 0 |
There was a problem hiding this comment.
behind is a list, so line 2060 should be updated accordingly.
There was a problem hiding this comment.
Do you want the behind is joined with " " ?
There was a problem hiding this comment.
The original code expected exactly two numbers, which is a correct assumption given that git rev-list --count --left-right HEAD...origin/master works as expected. I think behind[0] should suffice. What do you think?
There was a problem hiding this comment.
I think your's is best. will fix soon.
There was a problem hiding this comment.
Maybe we should test len(behind) == 1 instead?
EDIT: 1
b3e794b to
352cc75
Compare
plug.vim
Outdated
| let [ahead; behind] = split(s:lastline(output), '\t') | ||
| if !shellerror && ahead | ||
| if behind | ||
| if len(behind) == 1 |
There was a problem hiding this comment.
Ah, sorry, one more thing, I think we should change these lines to
if !shellerror && ahead && len(behind) == 1
if behind[0]352cc75 to
5e5bfac
Compare
plug.vim
Outdated
| let [ahead; behind] = split(s:lastline(output), '\t') | ||
| if !shellerror && ahead | ||
| if behind | ||
| if !shellerror && ahead && len(behind) == 1 |
There was a problem hiding this comment.
Sorry if I wasn't being clear. What I meant is to change line 2054 and 2055 as follows:
if !shellerror && ahead && len(behind) == 1
if behind[0]- First if statement checks if the output of the command conforms to the expected format
- Second if statement checks if
behind[0]is a non-zero value.
5e5bfac to
7dd874e
Compare
|
A few test cases are still failing on Vim 8: https://s3.amazonaws.com/archive.travis-ci.org/jobs/204097914/log.txt Looks like the lines in the output of the new system function are not properly separated by newline characters (
|
|
Sorry, It's difficult to read the test result for me. |
|
I'll look into those errors when I get some time. By the way, I tested the patched version on my machine.
|




Vim dispose jobs in main thread. So vim stop job operations while calling system(). This use job in s:system().
Left is without this patch. Right is with this patch.