Introduce FugitiveShellCommand() to replace FugitivePrepare()

We've moved on from the shell as the one true way, so let's demote the
one true preparation function.
This commit is contained in:
Tim Pope
2021-08-19 13:55:47 -04:00
parent 3125b07645
commit aae36024b8
2 changed files with 11 additions and 9 deletions

View File

@@ -1314,8 +1314,7 @@ endfunction
call s:add_methods('repo',['dir','tree','bare','find','translate','head']) call s:add_methods('repo',['dir','tree','bare','find','translate','head'])
function! s:repo_git_command(...) dict abort function! s:repo_git_command(...) dict abort
let git = s:GitShellCmd() . ' --git-dir='.s:shellesc(self.git_dir) throw 'fugitive: fugitive#repo().git_command(...) has been replaced by FugitiveShellCommand(...)'
return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'')
endfunction endfunction
function! s:repo_git_chomp(...) dict abort function! s:repo_git_chomp(...) dict abort

View File

@@ -125,14 +125,17 @@ function! FugitiveResult(...) abort
return call('fugitive#Result', a:000) return call('fugitive#Result', a:000)
endfunction endfunction
" FugitivePrepare() constructs a Git command string which can be executed with " FugitiveShellCommand() turns an array of arugments into a Git command string
" functions like system() and commands like :!. Integer arguments will be " which can be executed with functions like system() and commands like :!.
" treated as buffer numbers, and the appropriate relative path inserted in " Integer arguments will be treated as buffer numbers, and the appropriate
" their place. " relative path inserted in their place.
" "
" If the first argument is a string that looks like a path or an empty string, " An optional second argument provides the Git dir, or the buffer number of a
" it will be used as the Git dir. If it's a buffer number, the Git dir for " buffer with a Git dir. The default is the current buffer.
" that buffer will be used. The default is the current buffer. function! FugitiveShellCommand(...) abort
return call('fugitive#ShellCommand', a:000)
endfunction
function! FugitivePrepare(...) abort function! FugitivePrepare(...) abort
return call('fugitive#ShellCommand', a:000) return call('fugitive#ShellCommand', a:000)
endfunction endfunction