mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 18:47:29 -07:00
PlugDiff should be able to find pending updates
# We need the name of the default branch of origin git checkout some-tag-or-commit git log ..origin/master
This commit is contained in:
parent
6fa6475fee
commit
95ef5e8d5f
17
plug.vim
17
plug.vim
@ -2588,6 +2588,18 @@ function! s:append_ul(lnum, text)
|
|||||||
call append(a:lnum, ['', a:text, repeat('-', len(a:text))])
|
call append(a:lnum, ['', a:text, repeat('-', len(a:text))])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:git_origin_branch(spec)
|
||||||
|
if len(a:spec.branch)
|
||||||
|
return a:spec.branch
|
||||||
|
endif
|
||||||
|
|
||||||
|
let origin_head = a:spec.dir.'/.git/refs/remotes/origin/HEAD'
|
||||||
|
if !filereadable(origin_head)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
return split(readfile(origin_head)[0], '/')[-1]
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:diff()
|
function! s:diff()
|
||||||
call s:prepare()
|
call s:prepare()
|
||||||
call append(0, ['Collecting changes ...', ''])
|
call append(0, ['Collecting changes ...', ''])
|
||||||
@ -2602,7 +2614,9 @@ function! s:diff()
|
|||||||
endif
|
endif
|
||||||
call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
|
call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
|
||||||
for [k, v] in plugs
|
for [k, v] in plugs
|
||||||
let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..'
|
let branch = s:git_origin_branch(v)
|
||||||
|
if len(branch)
|
||||||
|
let range = origin ? '..origin/'.branch : 'HEAD@{1}..'
|
||||||
let cmd = ['git', 'log', '--graph', '--color=never']
|
let cmd = ['git', 'log', '--graph', '--color=never']
|
||||||
if s:git_version_requirement(2, 10, 0)
|
if s:git_version_requirement(2, 10, 0)
|
||||||
call add(cmd, '--no-show-signature')
|
call add(cmd, '--no-show-signature')
|
||||||
@ -2617,6 +2631,7 @@ function! s:diff()
|
|||||||
call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
|
call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
|
||||||
let cnts[origin] += 1
|
let cnts[origin] += 1
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
let bar .= '='
|
let bar .= '='
|
||||||
call s:progress_bar(2, bar, len(total))
|
call s:progress_bar(2, bar, len(total))
|
||||||
normal! 2G
|
normal! 2G
|
||||||
|
Loading…
Reference in New Issue
Block a user