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
43
plug.vim
43
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,20 +2614,23 @@ 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)
|
||||||
let cmd = ['git', 'log', '--graph', '--color=never']
|
if len(branch)
|
||||||
if s:git_version_requirement(2, 10, 0)
|
let range = origin ? '..origin/'.branch : 'HEAD@{1}..'
|
||||||
call add(cmd, '--no-show-signature')
|
let cmd = ['git', 'log', '--graph', '--color=never']
|
||||||
endif
|
if s:git_version_requirement(2, 10, 0)
|
||||||
call extend(cmd, ['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range])
|
call add(cmd, '--no-show-signature')
|
||||||
if has_key(v, 'rtp')
|
endif
|
||||||
call extend(cmd, ['--', v.rtp])
|
call extend(cmd, ['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range])
|
||||||
endif
|
if has_key(v, 'rtp')
|
||||||
let diff = s:system_chomp(cmd, v.dir)
|
call extend(cmd, ['--', v.rtp])
|
||||||
if !empty(diff)
|
endif
|
||||||
let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : ''
|
let diff = s:system_chomp(cmd, v.dir)
|
||||||
call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
|
if !empty(diff)
|
||||||
let cnts[origin] += 1
|
let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : ''
|
||||||
|
call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
|
||||||
|
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))
|
||||||
|
Loading…
Reference in New Issue
Block a user