From a3126a8503a5dcae5b992922c28fafe8085aef13 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Wed, 24 Oct 2018 21:39:20 -0700 Subject: [PATCH] feat(diff): use 'rtp' option to filter diff Previously, `:PlugDiff` would show every new commit to a plugin's git repo. This makes sense for the general case, but makes less sense when a plugin lives in a subdirectory of the repo (and is configured with the 'rtp' option). This makes it difficult to determine which commits relate to the plugin and which are unrelated. This changes `:PlugDiff` to filter out any commits outside of the 'rtp' folder. Some consequences: * This does not change the `:PlugUpdate` UI. This means `:PlugUpdate` may pull down non-plugin commits, display that it has updated the plugin, and then `:PlugDiff` will show no updates (since such commits fall out of the 'rtp' path). * It also means there's no UI to revert non-plugin updates, as they don't show up in `:PlugDiff`. Test: Manual on Linux machine --- plug.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index db1f615..83e71e1 100644 --- a/plug.vim +++ b/plug.vim @@ -2420,7 +2420,7 @@ function! s:diff() call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:') for [k, v] in plugs 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)')), v.dir) + 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)) if !empty(diff) 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)')))