diff --git a/autoload/gitgutter.vim b/autoload/gitgutter.vim index 82d8b67..e9dcc15 100644 --- a/autoload/gitgutter.vim +++ b/autoload/gitgutter.vim @@ -56,6 +56,8 @@ endfunction function! gitgutter#handle_diff(diff) + call setbufvar(gitgutter#utility#bufnr(), 'gitgutter_tracked', 1) + call gitgutter#hunk#set_hunks(gitgutter#diff#parse_diff(a:diff)) let modified_lines = gitgutter#diff#process_hunks(gitgutter#hunk#hunks()) diff --git a/autoload/gitgutter/diff.vim b/autoload/gitgutter/diff.vim index c5b875c..ef9af83 100644 --- a/autoload/gitgutter/diff.vim +++ b/autoload/gitgutter/diff.vim @@ -123,10 +123,6 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff) endif end - if !tracked - call setbufvar(bufnr, 'gitgutter_tracked', 1) - endif - if g:gitgutter_async && has('nvim') && !a:preserve_full_diff let cmd = gitgutter#utility#command_in_directory_of_file(cmd) " Note that when `cmd` doesn't produce any output, i.e. the diff is empty, diff --git a/test/testUntrackedFileSquareBracketsWithinRepo.vim b/test/testUntrackedFileSquareBracketsWithinRepo.vim new file mode 100644 index 0000000..b1fd48a --- /dev/null +++ b/test/testUntrackedFileSquareBracketsWithinRepo.vim @@ -0,0 +1,10 @@ +source helper.vim + +let tmpfile = '[un]trackedFileWithinRepo.tmp' +call system('touch '.tmpfile) +execute 'edit '.tmpfile +normal ggo* +doautocmd CursorHold +call DumpSigns('untrackedFileSquareBracketsWithinRepo') + +call system('rm '.tmpfile) diff --git a/test/testUntrackedFileWithinRepo.vim b/test/testUntrackedFileWithinRepo.vim index cbca9e7..4fdd48e 100644 --- a/test/testUntrackedFileWithinRepo.vim +++ b/test/testUntrackedFileWithinRepo.vim @@ -3,6 +3,8 @@ source helper.vim let tmpfile = 'untrackedFileWithinRepo.tmp' call system('touch '.tmpfile) execute 'edit '.tmpfile +normal ggo* +doautocmd CursorHold call DumpSigns('untrackedFileWithinRepo') call system('rm '.tmpfile) diff --git a/test/untrackedFileSquareBracketsWithinRepo.expected b/test/untrackedFileSquareBracketsWithinRepo.expected new file mode 100644 index 0000000..aa8cd86 --- /dev/null +++ b/test/untrackedFileSquareBracketsWithinRepo.expected @@ -0,0 +1,2 @@ + +--- Signs ---