get_diff_hg: Run diff from the file's parent directory
Mercurial's detection for where a file's containing repo is doesn't work well when the working directory is a different Mercurial repo (c.f., mhinz/vim-signify#146). Run "hg diff" from the target file's parent directory to work around this. Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
parent
babf2fd975
commit
6d45797393
@ -104,7 +104,7 @@ endfunction
|
|||||||
" Function: #get_diff_hg {{{1
|
" Function: #get_diff_hg {{{1
|
||||||
function! sy#repo#get_diff_hg() abort
|
function! sy#repo#get_diff_hg() abort
|
||||||
let diffoptions = has_key(g:signify_diffoptions, 'hg') ? g:signify_diffoptions.hg : ''
|
let diffoptions = has_key(g:signify_diffoptions, 'hg') ? g:signify_diffoptions.hg : ''
|
||||||
let diff = system('hg diff --nodates -U0 '. diffoptions .' -- '. sy#util#escape(b:sy.path))
|
let diff = sy#util#run_in_dir(fnamemodify(b:sy.path, ':h'), 'hg diff --nodates -U0 '. diffoptions .' -- '. sy#util#escape(b:sy.path))
|
||||||
|
|
||||||
return v:shell_error ? [0, ''] : [1, diff]
|
return v:shell_error ? [0, ''] : [1, diff]
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user