Ensure nested calls do not overwrite value of original shell.

See #379.
This commit is contained in:
Andy Stewart
2016-10-19 10:00:11 +01:00
parent b1734a3916
commit a693c0d326
3 changed files with 19 additions and 6 deletions

View File

@@ -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

View File

@@ -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')

View File

@@ -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')