mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 00:20:05 +08:00
fix(git): avoid repeated push
This commit is contained in:
parent
e542809569
commit
d6fad97fe7
15
bundle/git.vim/autoload/git/push.vim
vendored
15
bundle/git.vim/autoload/git/push.vim
vendored
@ -8,8 +8,15 @@
|
|||||||
let s:JOB = SpaceVim#api#import('job')
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
let s:NOTI = SpaceVim#api#import('notify')
|
let s:NOTI = SpaceVim#api#import('notify')
|
||||||
|
|
||||||
|
let s:push_jobid = 0
|
||||||
|
|
||||||
function! git#push#run(...) abort
|
function! git#push#run(...) abort
|
||||||
|
|
||||||
|
if s:push_jobid != 0
|
||||||
|
call s:NOTI.notify('previous push not finished')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
let s:NOTI.notify_max_width = float2nr( &columns * 0.3)
|
let s:NOTI.notify_max_width = float2nr( &columns * 0.3)
|
||||||
let s:std_data = {
|
let s:std_data = {
|
||||||
\ 'stderr' : [],
|
\ 'stderr' : [],
|
||||||
@ -19,13 +26,18 @@ function! git#push#run(...) abort
|
|||||||
if len(a:1) > 0
|
if len(a:1) > 0
|
||||||
let cmd += a:1
|
let cmd += a:1
|
||||||
endif
|
endif
|
||||||
call s:JOB.start(cmd, {
|
let s:push_jobid = s:JOB.start(cmd, {
|
||||||
\ 'on_stdout' : function('s:on_stdout'),
|
\ 'on_stdout' : function('s:on_stdout'),
|
||||||
\ 'on_stderr' : function('s:on_stderr'),
|
\ 'on_stderr' : function('s:on_stderr'),
|
||||||
\ 'on_exit' : function('s:on_exit'),
|
\ 'on_exit' : function('s:on_exit'),
|
||||||
\ }
|
\ }
|
||||||
\ )
|
\ )
|
||||||
|
|
||||||
|
if s:push_jobid == -1
|
||||||
|
call s:NOTI.notify('`git` is not executable')
|
||||||
|
let s:push_jobid = 0
|
||||||
|
endif
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_exit(id, data, event) abort
|
function! s:on_exit(id, data, event) abort
|
||||||
@ -40,6 +52,7 @@ function! s:on_exit(id, data, event) abort
|
|||||||
call s:NOTI.notify(line)
|
call s:NOTI.notify(line)
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
let s:push_jobid = 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user