diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 167cfb6..8b5b399 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1598,11 +1598,20 @@ function! fugitive#repo(...) abort endfunction function! s:repo_dir(...) dict abort - throw 'fugitive: fugitive#repo().dir() has been replaced by FugitiveGitDir()' + if !a:0 + return self.git_dir + endif + throw 'fugitive: fugitive#repo().dir("...") has been replaced by FugitiveFind(".git/...")' endfunction function! s:repo_tree(...) dict abort - throw 'fugitive: fugitive#repo().tree() has been replaced by FugitiveFind(":/")' + let tree = s:Tree(self.git_dir) + if empty(tree) + throw 'fugitive: no work tree' + elseif !a:0 + return tree + endif + throw 'fugitive: fugitive#repo().tree("...") has been replaced by FugitiveFind(":(top)...")' endfunction function! s:repo_bare() dict abort @@ -1628,11 +1637,11 @@ function! s:repo_git_command(...) dict abort endfunction function! s:repo_git_chomp(...) dict abort - throw 'fugitive: fugitive#repo().git_chomp(...) has been replaced by FugitiveExecute(...).stdout' + silent return substitute(system(fugitive#ShellCommand(a:000, self.git_dir)), '\n$', '', '') endfunction function! s:repo_git_chomp_in_tree(...) dict abort - throw 'fugitive: fugitive#repo().git_chomp_in_tree(...) has been replaced by FugitiveExecute(...).stdout' + return call(self.git_chomp, a:000, self) endfunction function! s:repo_rev_parse(rev) dict abort @@ -1642,7 +1651,7 @@ endfunction call s:add_methods('repo',['git_command','git_chomp','git_chomp_in_tree','rev_parse']) function! s:repo_config(name) dict abort - throw 'fugitive: fugitive#repo().config(...) has been replaced by FugitiveConfigGet(...)' + return FugitiveConfigGet(a:name, self.git_dir) endfunction call s:add_methods('repo',['config'])