mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 19:43:47 -05:00
Ensure nested calls do not overwrite value of original shell.
See #379.
This commit is contained in:
@@ -190,6 +190,7 @@ endfunction
|
|||||||
|
|
||||||
function! gitgutter#utility#use_known_shell() abort
|
function! gitgutter#utility#use_known_shell() abort
|
||||||
if has('unix')
|
if has('unix')
|
||||||
|
if &shell !=# 'sh'
|
||||||
let s:shell = &shell
|
let s:shell = &shell
|
||||||
let s:shellcmdflag = &shellcmdflag
|
let s:shellcmdflag = &shellcmdflag
|
||||||
let s:shellredir = &shellredir
|
let s:shellredir = &shellredir
|
||||||
@@ -197,6 +198,7 @@ function! gitgutter#utility#use_known_shell() abort
|
|||||||
set shellcmdflag=-c
|
set shellcmdflag=-c
|
||||||
set shellredir=>%s\ 2>&1
|
set shellredir=>%s\ 2>&1
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! gitgutter#utility#restore_shell() abort
|
function! gitgutter#utility#restore_shell() abort
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
source helper.vim
|
source helper.vim
|
||||||
call Setup()
|
call Setup()
|
||||||
|
|
||||||
|
set shell=foo
|
||||||
|
|
||||||
normal 5Gi*
|
normal 5Gi*
|
||||||
execute 'GitGutterStageHunk'
|
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 DumpSigns('hunkStageSigns')
|
||||||
call DumpGitDiffStaged('hunkStageGitDiff')
|
call DumpGitDiffStaged('hunkStageGitDiff')
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
source helper.vim
|
source helper.vim
|
||||||
call Setup()
|
call Setup()
|
||||||
|
|
||||||
|
set shell=foo
|
||||||
|
|
||||||
normal 5Gi*
|
normal 5Gi*
|
||||||
execute 'GitGutterUndoHunk'
|
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 DumpSigns('hunkUndoSigns')
|
||||||
call DumpGitDiffStaged('hunkUndoGitDiff')
|
call DumpGitDiffStaged('hunkUndoGitDiff')
|
||||||
|
|||||||
Reference in New Issue
Block a user