mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 03:53:47 -05:00
Pass filepath into s:fix_file_references() to make function pure.
This commit is contained in:
@@ -221,16 +221,16 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:adjust_header(bufnr, hunk_diff)
|
function! s:adjust_header(bufnr, hunk_diff)
|
||||||
return s:adjust_hunk_summary(s:fix_file_references(a:bufnr, a:hunk_diff))
|
let filepath = gitgutter#utility#repo_path(a:bufnr, 0)
|
||||||
|
return s:adjust_hunk_summary(s:fix_file_references(filepath, a:hunk_diff))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Replaces references to temp files with the actual file.
|
" Replaces references to temp files with the actual file.
|
||||||
function! s:fix_file_references(bufnr, hunk_diff)
|
function! s:fix_file_references(filepath, hunk_diff)
|
||||||
let filepath = gitgutter#utility#repo_path(a:bufnr, 0)
|
|
||||||
let diff = a:hunk_diff
|
let diff = a:hunk_diff
|
||||||
for tmp in matchlist(diff, '\vdiff --git ./(\S+) ./(\S+)\n')[1:2]
|
for tmp in matchlist(diff, '\vdiff --git ./(\S+) ./(\S+)\n')[1:2]
|
||||||
let diff = substitute(diff, tmp, filepath, 'g')
|
let diff = substitute(diff, tmp, a:filepath, 'g')
|
||||||
endfor
|
endfor
|
||||||
return diff
|
return diff
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user