mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 19:43:47 -05:00
Make command line config flag global
This commit is contained in:
@@ -4,14 +4,6 @@ let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ?
|
|||||||
|
|
||||||
let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
|
let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
|
||||||
|
|
||||||
" True for git v1.7.2+.
|
|
||||||
function! s:git_supports_command_line_config_override() abort
|
|
||||||
let [_, error_code] = gitgutter#utility#system(gitgutter#git().' -c foo.bar=baz --version')
|
|
||||||
return !error_code
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let s:c_flag = s:git_supports_command_line_config_override()
|
|
||||||
|
|
||||||
let s:temp_from = tempname()
|
let s:temp_from = tempname()
|
||||||
let s:temp_buffer = tempname()
|
let s:temp_buffer = tempname()
|
||||||
let s:counter = 0
|
let s:counter = 0
|
||||||
@@ -132,7 +124,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
|
|||||||
|
|
||||||
" Call git-diff.
|
" Call git-diff.
|
||||||
let cmd .= gitgutter#git().' --no-pager'
|
let cmd .= gitgutter#git().' --no-pager'
|
||||||
if s:c_flag
|
if gitgutter#utility#git_supports_command_line_config_override()
|
||||||
let cmd .= ' -c "diff.autorefreshindex=0"'
|
let cmd .= ' -c "diff.autorefreshindex=0"'
|
||||||
let cmd .= ' -c "diff.noprefix=false"'
|
let cmd .= ' -c "diff.noprefix=false"'
|
||||||
let cmd .= ' -c "core.safecrlf=false"'
|
let cmd .= ' -c "core.safecrlf=false"'
|
||||||
|
|||||||
@@ -6,6 +6,15 @@ function! gitgutter#utility#supports_overscore_sign()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" True for git v1.7.2+.
|
||||||
|
function! gitgutter#utility#git_supports_command_line_config_override() abort
|
||||||
|
if !exists('s:c_flag')
|
||||||
|
let [_, error_code] = gitgutter#utility#system(gitgutter#git().' -c foo.bar=baz --version')
|
||||||
|
let s:c_flag = !error_code
|
||||||
|
endif
|
||||||
|
return s:c_flag
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! gitgutter#utility#setbufvar(buffer, varname, val)
|
function! gitgutter#utility#setbufvar(buffer, varname, val)
|
||||||
let buffer = +a:buffer
|
let buffer = +a:buffer
|
||||||
" Default value for getbufvar() was introduced in Vim 7.3.831.
|
" Default value for getbufvar() was introduced in Vim 7.3.831.
|
||||||
|
|||||||
Reference in New Issue
Block a user