commit 94a5d6fe2f4f1abdabd97ffb243f8333bb20aa52 (tree)
parent 0cd33c617006a07331bf45c0970e3d4e82680f6a
Author: Tim Pope <code@tpope.net>
Date: Mon, 30 Jun 2014 14:02:53 -0400
Fix :Gcommit when closing message lands in different project
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -964,15 +964,16 @@ endfunction
call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit(<q-args>)")
-function! s:Commit(args) abort
+function! s:Commit(args, ...) abort
+ let repo = a:0 ? a:1 : s:repo()
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
- let msgfile = s:repo().dir('COMMIT_EDITMSG')
+ let msgfile = repo.dir('COMMIT_EDITMSG')
let outfile = tempname()
let errorfile = tempname()
try
try
- execute cd.s:fnameescape(s:repo().tree())
+ execute cd.s:fnameescape(repo.tree())
if s:winshell()
let command = ''
let old_editor = $GIT_EDITOR
@@ -980,7 +981,7 @@ function! s:Commit(args) abort
else
let command = 'env GIT_EDITOR=false '
endif
- let command .= s:repo().git_command('commit').' '.a:args
+ let command .= repo.git_command('commit').' '.a:args
if &shell =~# 'csh'
noautocmd silent execute '!('.command.' > '.outfile.') >& '.errorfile
elseif a:args =~# '\%(^\| \)-\%(-interactive\|p\|-patch\)\>'
@@ -1058,7 +1059,7 @@ function! s:FinishCommit() abort
let args = getbufvar(+expand('<abuf>'),'fugitive_commit_arguments')
if !empty(args)
call setbufvar(+expand('<abuf>'),'fugitive_commit_arguments','')
- return s:Commit(args)
+ return s:Commit(args, s:repo(getbufvar(+expand('<abuf>'),'git_dir')))
endif
return ''
endfunction