Use filename not path in git add

Since we change directory to the file's directory we can use its name
rather than its path in the repo.
This commit is contained in:
Andy Stewart
2023-06-03 10:25:28 +01:00
parent f7f1286aac
commit 7d425ff4b9

View File

@@ -301,9 +301,11 @@ function! s:stage(hunk_diff)
if choice =~ 'y' if choice =~ 'y'
let path = gitgutter#utility#repo_path(bufnr, 1) let path = gitgutter#utility#repo_path(bufnr, 1)
" Add file to index. " Add file to index.
call gitgutter#utility#system( let cmd = gitgutter#utility#cd_cmd(bufnr,
\ gitgutter#utility#cd_cmd(bufnr, g:gitgutter_git_executable.' '.g:gitgutter_git_args.' add '.path) \ g:gitgutter_git_executable.' '.g:gitgutter_git_args.
\ ) \ ' add '.
\ gitgutter#utility#shellescape(gitgutter#utility#filename(bufnr)))
call gitgutter#utility#system(cmd)
else else
return return
endif endif