Handle non-ASCII paths.

This prevents git-ls-files from escaping "unusual" characters in
pathnames.  When this happened, gitgutter would feed the escaped name
back to git-show but git-show would not recognise it.

This commit makes git-ls-files use the -z option to output pathnames
verbatim.  These pathnames also become null terminated so we have to
ensure we remove the null terminator too.

Closes #562.
This commit is contained in:
Andy Stewart
2018-11-17 11:24:36 +00:00
parent 0597380f6b
commit 947737c76f
2 changed files with 21 additions and 2 deletions

View File

@@ -191,6 +191,20 @@ function Test_filename_leading_dash()
endfunction
function Test_filename_umlaut()
call system('touch -- fixtüre.txt && git add -- fixtüre.txt')
edit fixtüre.txt
normal ggo*
call s:trigger_gitgutter()
let expected = [
\ 'line=1 id=3000 name=GitGutterLineAdded',
\ 'line=2 id=3001 name=GitGutterLineAdded'
\ ]
call assert_equal(expected, s:signs('fixtüre.txt'))
endfunction
" FIXME: this test fails when it is the first (or only) test to be run
function Test_follow_symlink()
let tmp = 'symlink'