Skip to content

Commit 5b440ea

Browse files
committed
Fix fatal file length messages.
1 parent f4eb22a commit 5b440ea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

autoload/blamer.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ if exists('g:blamer_autoloaded')
44
finish
55
endif
66
let g:blamer_autoloaded = 1
7+
let s:tmpfile = tempname()
78

89
let s:save_cpo = &cpoptions
910
set cpoptions&vim
@@ -126,7 +127,8 @@ function! blamer#GetMessages(file, line_number, line_count) abort
126127
let l:dir_path = shellescape(s:substitute_path_separator(expand('%:h')))
127128
let l:end_line = a:line_number + a:line_count - 1
128129
let l:file_path_escaped = shellescape(a:file)
129-
let l:command = 'git -C ' . l:dir_path . ' --no-pager blame --line-porcelain -L ' . a:line_number . ',' . l:end_line . ' -- ' . l:file_path_escaped
130+
silent! execute 'write' fnameescape(s:tmpfile)
131+
let l:command = 'git -C ' . l:dir_path . ' --no-pager blame --line-porcelain -L ' . a:line_number . ',' . l:end_line . ' --contents ' . s:tmpfile . ' -- ' . l:file_path_escaped
130132
let l:result = system(l:command)
131133
let l:lines = split(l:result, '\n')
132134

0 commit comments

Comments
 (0)