mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Handle file which does not exist in diff base
If g:gitgutter_diff_base has been set and the file being processed does not exist in that branch/commit, ensure that every line is marked as added - this is how git-diff behaves. Fixes #855.
This commit is contained in:
@@ -348,6 +348,21 @@ function Test_untracked_file_square_brackets_within_repo()
|
||||
endfunction
|
||||
|
||||
|
||||
function Test_file_unknown_in_base()
|
||||
let starting_branch = system('git branch --show-current')
|
||||
let starting_branch = 'main'
|
||||
call system('git checkout -b some-feature')
|
||||
let tmp = 'file-on-this-branch-only.tmp'
|
||||
call system('echo "hi" > '.tmp.' && git add '.tmp)
|
||||
execute 'edit '.tmp
|
||||
let g:gitgutter_diff_base = starting_branch
|
||||
GitGutter
|
||||
let expected = [{'lnum': 1, 'name': 'GitGutterLineAdded', 'group': 'gitgutter', 'priority': 10}]
|
||||
call s:assert_signs(expected, tmp)
|
||||
let g:gitgutter_diff_base = ''
|
||||
endfunction
|
||||
|
||||
|
||||
function Test_hunk_outside_noop()
|
||||
5
|
||||
GitGutterStageHunk
|
||||
|
||||
Reference in New Issue
Block a user