From 0aa3389f5c4b1928c2f5a4c4048d3850c109e753 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 19 Jul 2018 02:09:51 -0400 Subject: [PATCH] Decouple :Gcommit from repo object --- autoload/fugitive.vim | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 3dc7f6f..6188a62 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1228,10 +1228,11 @@ call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute function! s:Commit(mods, args, ...) abort let mods = s:gsub(a:mods ==# '' ? '' : a:mods, '', '-tab') - let repo = a:0 ? a:1 : s:repo() + let dir = a:0 ? a:1 : b:git_dir + let tree = FugitiveTreeForGitDir(dir) let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' - let dir = getcwd() - let msgfile = repo.dir('COMMIT_EDITMSG') + let cwd = getcwd() + let msgfile = dir . '/COMMIT_EDITMSG' let outfile = tempname() let errorfile = tempname() try @@ -1240,7 +1241,7 @@ function! s:Commit(mods, args, ...) abort if &guioptions =~# '!' setglobal guioptions-=! endif - execute cd s:fnameescape(repo.tree()) + execute cd s:fnameescape(tree) if s:winshell() let command = '' let old_editor = $GIT_EDITOR @@ -1258,7 +1259,7 @@ function! s:Commit(mods, args, ...) abort endif let error = v:shell_error finally - execute cd s:fnameescape(dir) + execute cd s:fnameescape(cwd) let &guioptions = guioptions endtry if !has('gui_running') @@ -1281,7 +1282,7 @@ function! s:Commit(mods, args, ...) abort let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' let cwd = getcwd() try - exe cd s:fnameescape(repo.tree()) + exe cd s:fnameescape(tree) let args = s:gsub(args,'\\@'),'fugitive_commit_arguments') if !empty(args) call setbufvar(+expand(''),'fugitive_commit_arguments','') - return s:Commit('', args, s:repo(getbufvar(+expand(''),'git_dir'))) + return s:Commit('', args, getbufvar(+expand(''),'git_dir')) endif return '' endfunction