Skip to content

Commit

Permalink
Commit preview should work with non-POSIX-compliant &shell
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Jan 2, 2017
1 parent d5e9f91 commit 93ffcb3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,12 @@ function! s:preview_commit()
wincmd P
endif
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
execute 'silent %!cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha
try
let [sh, shrd] = s:chsh(1)
execute 'silent %!cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha
finally
let [&shell, &shellredir] = [sh, shrd]
endtry
setlocal nomodifiable
nnoremap <silent> <buffer> q :q<cr>
wincmd p
Expand Down
21 changes: 21 additions & 0 deletions test/workflow.vader
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,27 @@ Execute (Test g:plug_pwindow):
normal q
unlet g:plug_pwindow

Execute (#572 - Commit preview should work with non-POSIX-compliant &shell):
" Invalid shell
let shell = &shell
set shell=shellfish

try
" Preview commit should still work
PlugDiff
execute "normal ]]jo"
wincmd P
Log getline(1, '$')
Assert getline(1) =~ 'commit', 'Preview window is empty'
AssertEqual 'shellfish', &shell
finally
" Restore &shell
let &shell = shell
unlet shell
pclose
q
endtry

Execute (Reuse Plug window in another tab):
let tabnr = tabpagenr()
PlugDiff
Expand Down

0 comments on commit 93ffcb3

Please sign in to comment.