mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-12-09 05:24:58 +08:00
Respect GIT_INDEX_FILE when diffing for status buffer
This commit is contained in:
@@ -2693,8 +2693,8 @@ function! fugitive#BufReadStatus(cmdbang) abort
|
|||||||
let branch = FugitiveHead(0)
|
let branch = FugitiveHead(0)
|
||||||
let head = FugitiveHead(11)
|
let head = FugitiveHead(11)
|
||||||
elseif fugitive#GitVersion(2, 11)
|
elseif fugitive#GitVersion(2, 11)
|
||||||
let cmd += ['status', '--porcelain=v2', '-bz']
|
let status_cmd = cmd + ['status', '--porcelain=v2', '-bz']
|
||||||
let [output, message, exec_error] = s:NullError(cmd)
|
let [output, message, exec_error] = s:NullError(status_cmd)
|
||||||
if exec_error
|
if exec_error
|
||||||
throw 'fugitive: ' . message
|
throw 'fugitive: ' . message
|
||||||
endif
|
endif
|
||||||
@@ -2741,8 +2741,8 @@ function! fugitive#BufReadStatus(cmdbang) abort
|
|||||||
let head = FugitiveHead(11)
|
let head = FugitiveHead(11)
|
||||||
endif
|
endif
|
||||||
else " git < 2.11
|
else " git < 2.11
|
||||||
let cmd += ['status', '--porcelain', '-bz']
|
let status_cmd = cmd + ['status', '--porcelain', '-bz']
|
||||||
let [output, message, exec_error] = s:NullError(cmd)
|
let [output, message, exec_error] = s:NullError(status_cmd)
|
||||||
if exec_error
|
if exec_error
|
||||||
throw 'fugitive: ' . message
|
throw 'fugitive: ' . message
|
||||||
endif
|
endif
|
||||||
@@ -2787,14 +2787,13 @@ function! fugitive#BufReadStatus(cmdbang) abort
|
|||||||
endwhile
|
endwhile
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let diff_cmd = cmd + ['-c', 'diff.suppressBlankEmpty=false', '-c', 'core.quotePath=false', 'diff', '--color=never', '--no-ext-diff', '--no-prefix']
|
||||||
let diff = {'Staged': {'stdout': ['']}, 'Unstaged': {'stdout': ['']}}
|
let diff = {'Staged': {'stdout': ['']}, 'Unstaged': {'stdout': ['']}}
|
||||||
if len(staged)
|
if len(staged)
|
||||||
let diff['Staged'] =
|
let diff['Staged'] = fugitive#Execute(diff_cmd + ['--cached'], function('len'))
|
||||||
\ fugitive#Execute(['-c', 'diff.suppressBlankEmpty=false', '-c', 'core.quotePath=false', 'diff', '--color=never', '--no-ext-diff', '--no-prefix', '--cached'], function('len'))
|
|
||||||
endif
|
endif
|
||||||
if len(unstaged)
|
if len(unstaged)
|
||||||
let diff['Unstaged'] =
|
let diff['Unstaged'] = fugitive#Execute(diff_cmd, function('len'))
|
||||||
\ fugitive#Execute(['-c', 'diff.suppressBlankEmpty=false', '-c', 'core.quotePath=false', 'diff', '--color=never', '--no-ext-diff', '--no-prefix'], function('len'))
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for dict in staged
|
for dict in staged
|
||||||
|
|||||||
Reference in New Issue
Block a user