diff --git a/autoload/gitgutter/utility.vim b/autoload/gitgutter/utility.vim index 319cf6d..9e13a8b 100644 --- a/autoload/gitgutter/utility.vim +++ b/autoload/gitgutter/utility.vim @@ -190,12 +190,14 @@ endfunction function! gitgutter#utility#use_known_shell() abort if has('unix') - let s:shell = &shell - let s:shellcmdflag = &shellcmdflag - let s:shellredir = &shellredir - let &shell = 'sh' - set shellcmdflag=-c - set shellredir=>%s\ 2>&1 + if &shell !=# 'sh' + let s:shell = &shell + let s:shellcmdflag = &shellcmdflag + let s:shellredir = &shellredir + let &shell = 'sh' + set shellcmdflag=-c + set shellredir=>%s\ 2>&1 + endif endif endfunction diff --git a/test/testHunkStage.vim b/test/testHunkStage.vim index 6f818fb..6acf19e 100644 --- a/test/testHunkStage.vim +++ b/test/testHunkStage.vim @@ -1,7 +1,13 @@ source helper.vim call Setup() +set shell=foo + normal 5Gi* execute 'GitGutterStageHunk' + +call assert_equal('foo', &shell) " NOTE: current test runner ignores v:errors so this line has no effect + +set shell=/bin/bash call DumpSigns('hunkStageSigns') call DumpGitDiffStaged('hunkStageGitDiff') diff --git a/test/testHunkUndo.vim b/test/testHunkUndo.vim index 9d187a7..2afc8fa 100644 --- a/test/testHunkUndo.vim +++ b/test/testHunkUndo.vim @@ -1,7 +1,12 @@ source helper.vim call Setup() +set shell=foo + normal 5Gi* execute 'GitGutterUndoHunk' + +call assert_equal('foo', &shell) " NOTE: current test runner ignores v:errors so this line has no effect +set shell=/bin/bash call DumpSigns('hunkUndoSigns') call DumpGitDiffStaged('hunkUndoGitDiff')