Skip to content

Commit

Permalink
Use filename not path in git add
Browse files Browse the repository at this point in the history
Since we change directory to the file's directory we can use its name
rather than its path in the repo.
  • Loading branch information
airblade committed Jun 3, 2023
1 parent f7f1286 commit 7d425ff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autoload/gitgutter/hunk.vim
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,11 @@ function! s:stage(hunk_diff)
if choice =~ 'y'
let path = gitgutter#utility#repo_path(bufnr, 1)
" Add file to index.
call gitgutter#utility#system(
\ gitgutter#utility#cd_cmd(bufnr, g:gitgutter_git_executable.' '.g:gitgutter_git_args.' add '.path)
\ )
let cmd = gitgutter#utility#cd_cmd(bufnr,
\ g:gitgutter_git_executable.' '.g:gitgutter_git_args.
\ ' add '.
\ gitgutter#utility#shellescape(gitgutter#utility#filename(bufnr)))
call gitgutter#utility#system(cmd)
else
return
endif
Expand Down

0 comments on commit 7d425ff

Please sign in to comment.