add test and do not apply filter unconditionally

This commit is contained in:
Nate Fischer 2018-10-24 23:05:22 -07:00
parent a3126a8503
commit 66afc9337e
2 changed files with 50 additions and 1 deletions

View File

@ -2420,7 +2420,11 @@ function! s:diff()
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 range = origin ? '..origin/'.v.branch : 'HEAD@{1}..'
let diff = s:system_chomp('git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)')).' -- .', s:rtp(v)) let cmd = 'git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)'))
if has_key(v, 'rtp')
let cmd .= ' -- ' . v.rtp
endif
let diff = s:system_chomp(cmd, v.dir)
if !empty(diff) if !empty(diff)
let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' 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)'))) call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))

View File

@ -537,6 +537,51 @@ Execute (PlugDiff):
Assert !empty(mapcheck("\<cr>")) Assert !empty(mapcheck("\<cr>"))
q q
Execute (Do not show diff for commits outside of rtp):
call plug#begin()
call plug#end()
PlugClean!
call plug#begin()
Plug 'file://'.expand('$PLUG_FIXTURES').'/xxx'
Plug 'file://'.expand('$PLUG_FIXTURES').'/yyy', { 'rtp': 'rtp' }
call plug#end()
PlugInstall
Log getline(1, '$')
call system('cd "$PLUG_FIXTURES/xxx" && git commit --allow-empty -m update-xxx && git tag -f xxx')
call system('cd "$PLUG_FIXTURES/yyy" && git commit --allow-empty -m update-yyy && git tag -f yyy')
let g:plugs.yyy.tag = 'yyy'
PlugUpdate
Log getline(1, '$')
PlugDiff
" 1 plugin(s) updated.
" [==]
"
" Last update:
" ------------
"
" - xxx:
" * 7faa9b2 update-xxx (0 seconds ago)
"
" Pending updates:
" ----------------
"
" N/A
"
Log getline(1, '$')
AssertEqual 14, line('$')
AssertEqual '1 plugin(s) updated.', getline(1)
AssertEqual '[==]', getline(2)
AssertEqual 'Last update:', getline(4)
AssertEqual '- xxx:', getline(7)
Assert !empty(mapcheck('o'))
Assert !empty(mapcheck('X'))
Assert !empty(mapcheck("\<cr>"))
q
********************************************************************** **********************************************************************
~ On-demand loading / Partial installation/update ~ ~ On-demand loading / Partial installation/update ~
********************************************************************** **********************************************************************