Add g:gitgutter_git_args for args to git when running git-diff.

See #541, #546.
This commit is contained in:
Andy Stewart
2018-07-31 14:28:36 +01:00
parent d2f38f401a
commit d2d2da11c5
4 changed files with 21 additions and 1 deletions

View File

@@ -212,6 +212,7 @@ You can customise:
* The signs' colours and symbols
* Line highlights
* The base of the diff
* Extra arguments for `git` when running `git diff`
* Extra arguments for `git diff`
* Key mappings
* Whether or not vim-gitgutter is on initially (defaults to on)
@@ -297,6 +298,14 @@ let g:gitgutter_diff_base = '<commit SHA>'
```
#### Extra arguments for `git` when running `git diff`
If you want to pass extra arguments to `git` when running `git diff`, do so like this:
```viml
let g:gitgutter_git_args = '--git-dir-""'
```
#### Extra arguments for `git diff`
If you want to pass extra arguments to `git diff`, for example to ignore whitespace, do so like this:

View File

@@ -100,7 +100,7 @@ function! gitgutter#diff#run_diff(bufnr, preserve_full_diff) abort
call s:write_buffer(a:bufnr, buff_file)
" Call git-diff with the temporary files.
let cmd .= g:gitgutter_git_executable.' --no-pager'
let cmd .= g:gitgutter_git_executable.' --no-pager '.g:gitgutter_git_args
if s:c_flag
let cmd .= ' -c "diff.autorefreshindex=0"'
let cmd .= ' -c "diff.noprefix=false"'

View File

@@ -232,6 +232,7 @@ Most important option:~
Git:~
|g:gitgutter_git_executable|
|g:gitgutter_git_args|
|g:gitgutter_diff_args|
|g:gitgutter_diff_base|
@@ -270,6 +271,15 @@ Default: 'git'
This option determines what git binary to use. Set this if git is not on your
path.
*g:gitgutter_git_args*
Default: empty
Use this option to pass any extra arguments to git when running git-diff.
For example:
>
let g:gitgutter_git_args = '--git-dir=""'
<
*g:gitgutter_diff_args*
Default: empty

View File

@@ -45,6 +45,7 @@ else
endif
call s:set('g:gitgutter_sign_modified_removed', '~_')
call s:set('g:gitgutter_git_args', '')
call s:set('g:gitgutter_diff_args', '')
call s:set('g:gitgutter_diff_base', '')
call s:set('g:gitgutter_map_keys', 1)