Always use path relative to repo root with git-show.

More recent versions of git support paths relative to current directory.
But for maximum compatibility we need to use paths relative to the
file's repo's root.
This commit is contained in:
Andy Stewart
2014-01-29 13:47:22 +01:00
parent 721c96c8ef
commit 974cd952fc
2 changed files with 15 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ function! diff#run_diff(realtime, use_external_grep)
let cmd = 'git ls-files --error-unmatch ' . shellescape(utility#file()) . ' && ('
if a:realtime
let blob_name = ':./' . fnamemodify(utility#file(),':t')
let blob_name = ':' . utility#file_relative_to_repo_root()
let blob_file = tempname()
let cmd .= 'git show ' . blob_name . ' > ' . blob_file .
\ ' && diff -U0 ' . g:gitgutter_diff_args . ' ' . blob_file . ' - '