mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Extract function to reduce duplication
This commit is contained in:
@@ -302,8 +302,7 @@ function! s:stage(hunk_diff)
|
||||
let path = gitgutter#utility#repo_path(bufnr, 1)
|
||||
" Add file to index.
|
||||
let cmd = gitgutter#utility#cd_cmd(bufnr,
|
||||
\ g:gitgutter_git_executable.' '.g:gitgutter_git_args.
|
||||
\ ' add '.
|
||||
\ gitgutter#git().' add '.
|
||||
\ gitgutter#utility#shellescape(gitgutter#utility#filename(bufnr)))
|
||||
call gitgutter#utility#system(cmd)
|
||||
else
|
||||
@@ -314,7 +313,7 @@ function! s:stage(hunk_diff)
|
||||
let diff = s:adjust_header(bufnr, a:hunk_diff)
|
||||
" Apply patch to index.
|
||||
call gitgutter#utility#system(
|
||||
\ gitgutter#utility#cd_cmd(bufnr, g:gitgutter_git_executable.' '.g:gitgutter_git_args.' apply --cached --unidiff-zero - '),
|
||||
\ gitgutter#utility#cd_cmd(bufnr, gitgutter#git().' apply --cached --unidiff-zero - '),
|
||||
\ diff)
|
||||
endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user