mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 05:13:53 -05:00
Restore popular fugitive#repo() functions
I'm quite eager to kill the "chomp" functions, as they're the last use of system(). However, the successor, FugitiveExecute(), is only a year old, and isn't a drop-in replacement. So let's bring them back for awhile to avoid the need for a massive conditional to give backwards compatibility. The rest are pretty benign to support, so I guess they can stick around until the band-aid is officially ripped off.
This commit is contained in:
@@ -1598,11 +1598,20 @@ function! fugitive#repo(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repo_dir(...) dict abort
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:repo_tree(...) dict abort
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:repo_bare() dict abort
|
function! s:repo_bare() dict abort
|
||||||
@@ -1628,11 +1637,11 @@ function! s:repo_git_command(...) dict abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repo_git_chomp(...) dict abort
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:repo_git_chomp_in_tree(...) dict abort
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:repo_rev_parse(rev) dict abort
|
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'])
|
call s:add_methods('repo',['git_command','git_chomp','git_chomp_in_tree','rev_parse'])
|
||||||
|
|
||||||
function! s:repo_config(name) dict abort
|
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
|
endfunction
|
||||||
|
|
||||||
call s:add_methods('repo',['config'])
|
call s:add_methods('repo',['config'])
|
||||||
|
|||||||
Reference in New Issue
Block a user