From aae36024b89e34db0280b5361633fb036b17951f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 19 Aug 2021 13:55:47 -0400 Subject: [PATCH] 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. --- autoload/fugitive.vim | 3 +-- plugin/fugitive.vim | 17 ++++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index be8618b..348e151 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1314,8 +1314,7 @@ endfunction call s:add_methods('repo',['dir','tree','bare','find','translate','head']) function! s:repo_git_command(...) dict abort - let git = s:GitShellCmd() . ' --git-dir='.s:shellesc(self.git_dir) - return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'') + throw 'fugitive: fugitive#repo().git_command(...) has been replaced by FugitiveShellCommand(...)' endfunction function! s:repo_git_chomp(...) dict abort diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 63c6c88..072f607 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -125,14 +125,17 @@ function! FugitiveResult(...) abort return call('fugitive#Result', a:000) endfunction -" FugitivePrepare() constructs a Git command string which can be executed with -" functions like system() and commands like :!. Integer arguments will be -" treated as buffer numbers, and the appropriate relative path inserted in -" their place. +" FugitiveShellCommand() turns an array of arugments into a Git command string +" which can be executed with functions like system() and commands like :!. +" Integer arguments will be treated as buffer numbers, and the appropriate +" relative path inserted in their place. " -" If the first argument is a string that looks like a path or an empty string, -" it will be used as the Git dir. If it's a buffer number, the Git dir for -" that buffer will be used. The default is the current buffer. +" An optional second argument provides the Git dir, or the buffer number of a +" buffer with a Git dir. The default is the current buffer. +function! FugitiveShellCommand(...) abort + return call('fugitive#ShellCommand', a:000) +endfunction + function! FugitivePrepare(...) abort return call('fugitive#ShellCommand', a:000) endfunction