@@ -313,7 +313,7 @@ endfunction
313
313
314
314
function ! s: git_version_requirement (... )
315
315
if ! exists (' s:git_version' )
316
- let s: git_version = map (split (split (s: system (' git --version' ))[2 ], ' \.' ), ' str2nr(v:val)' )
316
+ let s: git_version = map (split (split (s: system (' git --version' )[ 0 ] )[2 ], ' \.' ), ' str2nr(v:val)' )
317
317
endif
318
318
return s: version_requirement (s: git_version , a: 000 )
319
319
endfunction
@@ -865,12 +865,12 @@ endfunction
865
865
866
866
function ! s: checkout (spec)
867
867
let sha = a: spec .commit
868
- let [output, shellerror] = s: system_with_error (' git rev-parse HEAD' , a: spec .dir )
868
+ let [output, shellerror] = s: system (' git rev-parse HEAD' , a: spec .dir )
869
869
if ! shellerror && ! s: hash_match (sha, s: lines (output)[0 ])
870
- let output = s: system (
870
+ let [ output, shellerror] = s: system (
871
871
\ ' git fetch --depth 999999 && git checkout ' .s: esc (sha), a: spec .dir )
872
872
endif
873
- return output
873
+ return [ output, shellerror]
874
874
endfunction
875
875
876
876
function ! s: finish (pull)
@@ -1056,11 +1056,11 @@ function! s:update_finish()
1056
1056
let shellerror = 0
1057
1057
if has_key (spec, ' commit' )
1058
1058
call s: log4 (name, ' Checking out ' .spec.commit)
1059
- let out = s: checkout (spec)
1059
+ let [ out, shellerror] = s: checkout (spec)
1060
1060
elseif has_key (spec, ' tag' )
1061
1061
let tag = spec.tag
1062
1062
if tag = ~ ' \*'
1063
- let [output, shellerror] = s: system_with_error (' git tag --list ' .string (tag ).' --sort -version:refname 2>&1' , spec.dir )
1063
+ let [output, shellerror] = s: system (' git tag --list ' .string (tag ).' --sort -version:refname 2>&1' , spec.dir )
1064
1064
let tags = s: lines (output)
1065
1065
if ! shellerror && ! empty (tags )
1066
1066
let tag = tags [0 ]
@@ -1069,11 +1069,11 @@ function! s:update_finish()
1069
1069
endif
1070
1070
endif
1071
1071
call s: log4 (name, ' Checking out ' .tag )
1072
- let out = s: system (' git checkout -q ' .s: esc (tag ).' 2>&1' , spec.dir )
1072
+ let [ out, shellerror] = s: system (' git checkout -q ' .s: esc (tag ).' 2>&1' , spec.dir )
1073
1073
else
1074
1074
let branch = s: esc (get (spec, ' branch' , ' master' ))
1075
1075
call s: log4 (name, ' Merging origin/' .branch)
1076
- let out = s: system (' git checkout -q ' .branch.' 2>&1'
1076
+ let [ out, shellerror] = s: system (' git checkout -q ' .branch.' 2>&1'
1077
1077
\. (has_key (s: update .new , name) ? ' ' : (' && git merge --ff-only origin/' .branch.' 2>&1' )), spec.dir )
1078
1078
endif
1079
1079
if ! shellerror && filereadable (spec.dir .' /.gitmodules' ) &&
@@ -1205,7 +1205,7 @@ function! s:spawn(name, cmd, opts)
1205
1205
endif
1206
1206
else
1207
1207
let params = has_key (a: opts , ' dir' ) ? [a: cmd , a: opts .dir ] : [a: cmd ]
1208
- let [output, shellerror] = call (' s:system_with_error ' , params)
1208
+ let [output, shellerror] = call (' s:system ' , params)
1209
1209
let job.lines = s: lines (output)
1210
1210
let job.error = shellerror != 0
1211
1211
let job.running = 0
@@ -1981,26 +1981,6 @@ function! s:with_cd(cmd, dir)
1981
1981
endfunction
1982
1982
1983
1983
function ! s: system (cmd, ... )
1984
- try
1985
- let maxfuncdepth = &maxfuncdepth
1986
- set maxfuncdepth = 99999
1987
- let [sh , shrd] = s: chsh (1 )
1988
- let cmd = a: 0 > 0 ? s: with_cd (a: cmd , a: 1 ) : a: cmd
1989
- if s: vim8
1990
- let out = ' '
1991
- let job = job_start ([&shell , &shellcmdflag , cmd], {' out_cb' : {ch ,msg- >[execute (" let out .= msg" ), out]}, ' out_mode' : ' raw' })
1992
- while job_status (job) == ' run'
1993
- sleep 10 m
1994
- endwhile
1995
- return out
1996
- endif
1997
- return system (s: is_win ? ' (' .cmd.' )' : cmd)
1998
- finally
1999
- let [&shell , &shellredir , &maxfuncdepth ] = [sh , shrd, maxfuncdepth ]
2000
- endtry
2001
- endfunction
2002
-
2003
- function ! s: system_with_error (cmd, ... )
2004
1984
try
2005
1985
let maxfuncdepth = &maxfuncdepth
2006
1986
set maxfuncdepth = 99999
@@ -2025,14 +2005,14 @@ function! s:system_with_error(cmd, ...)
2025
2005
endfunction
2026
2006
2027
2007
function ! s: system_chomp (... )
2028
- let [ret , shellerror] = call (' s:system_with_error ' , a: 000 )
2008
+ let [ret , shellerror] = call (' s:system ' , a: 000 )
2029
2009
return shellerror ? ' ' : substitute (ret , ' \n$' , ' ' , ' ' )
2030
2010
endfunction
2031
2011
2032
2012
function ! s: git_validate (spec, check_branch)
2033
2013
let err = ' '
2034
2014
if isdirectory (a: spec .dir )
2035
- let [output, shellerror] = s: system_with_error (' git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' , a: spec .dir )
2015
+ let [output, shellerror] = s: system (' git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' , a: spec .dir )
2036
2016
let result = s: lines (output)
2037
2017
let remote = result[-1 ]
2038
2018
if shellerror
@@ -2042,7 +2022,7 @@ function! s:git_validate(spec, check_branch)
2042
2022
\ ' Expected: ' .a: spec .uri,
2043
2023
\ ' PlugClean required.' ], " \n " )
2044
2024
elseif a: check_branch && has_key (a: spec , ' commit' )
2045
- let [output, shellerror] = s: system_with_error (' git rev-parse HEAD 2>&1' , a: spec .dir )
2025
+ let [output, shellerror] = s: system (' git rev-parse HEAD 2>&1' , a: spec .dir )
2046
2026
let result = s: lines (output)
2047
2027
let sha = result[-1 ]
2048
2028
if shellerror
@@ -2067,7 +2047,7 @@ function! s:git_validate(spec, check_branch)
2067
2047
\ branch, a: spec .branch)
2068
2048
endif
2069
2049
if empty (err)
2070
- let [output, shellerror] = s: system_with_error (printf (
2050
+ let [output, shellerror] = s: system (printf (
2071
2051
\ ' git rev-list --count --left-right HEAD...origin/%s' ,
2072
2052
\ a: spec .branch), a: spec .dir )
2073
2053
let [ahead, behind] = split (s: lastline (output), ' \t' )
@@ -2203,7 +2183,7 @@ function! s:upgrade()
2203
2183
let new = tmp . ' /plug.vim'
2204
2184
2205
2185
try
2206
- let [out, shellerror] = s: system_with_error (printf (' git clone --depth 1 %s %s' , s: plug_src , tmp))
2186
+ let [out, shellerror] = s: system (printf (' git clone --depth 1 %s %s' , s: plug_src , tmp))
2207
2187
if shellerror
2208
2188
return s: err (' Error upgrading vim-plug: ' . out)
2209
2189
endif
0 commit comments