commit 020802475caa8cc20000d2fc4d6b51af1acf1ffa (tree)
parent 535389b9a64be18349394c192bcf0348c0dee64e
Author: Tim Pope <code@tpope.net>
Date: Sun, 12 Jun 2022 12:46:53 -0400
Add error stubs for old fugitive#repo() object
This is still used in the wild, so provide error messages to aid in
transitioning.
Diffstat:
1 file changed, 59 insertions(+), 0 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -1522,6 +1522,65 @@ function! fugitive#Cwindow() abort
endif
endfunction
+" Section: Repository Object
+
+let s:repo_prototype = {}
+
+function! fugitive#repo(...) abort
+ return copy(s:repo_prototype)
+endfunction
+
+function! s:repo_dir(...) dict abort
+ throw 'fugitive: fugitive#repo().dir() has been replaced by FugitiveGitDir()'
+endfunction
+
+function! s:repo_tree(...) dict abort
+ throw 'fugitive: fugitive#repo().tree() has been replaced by FugitiveFind(":/")'
+endfunction
+
+function! s:repo_bare() dict abort
+ throw 'fugitive: fugitive#repo().bare() has been replaced by !empty(FugitiveWorkTree())'
+endfunction
+
+function! s:repo_find(object) dict abort
+ throw 'fugitive: fugitive#repo().find(...) has been replaced by FugitiveFind(...)'
+endfunction
+
+function! s:repo_translate(rev) dict abort
+ throw 'fugitive: fugitive#repo().translate(...) has been replaced by FugitiveFind(...)'
+endfunction
+
+function! s:repo_head(...) dict abort
+ throw 'fugitive: fugitive#repo().head(...) has been replaced by FugitiveHead(...)'
+endfunction
+
+call s:add_methods('repo',['dir','tree','bare','find','translate','head'])
+
+function! s:repo_git_command(...) dict abort
+ throw 'fugitive: fugitive#repo().git_command(...) has been replaced by FugitiveShellCommand(...)'
+endfunction
+
+function! s:repo_git_chomp(...) dict abort
+ throw 'fugitive: fugitive#repo().git_chomp(...) has been replaced by FugitiveExecute(...).stdout'
+endfunction
+
+function! s:repo_git_chomp_in_tree(...) dict abort
+ throw 'fugitive: fugitive#repo().git_chomp_in_tree(...) has been replaced by FugitiveExecute(...).stdout'
+endfunction
+
+function! s:repo_rev_parse(rev) dict abort
+ throw 'fugitive: fugitive#repo().rev_parse(...) has been replaced by FugitiveExecute("rev-parse", "--verify", ...).stdout'
+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(...).stdout'
+ return FugitiveConfigGet(a:name, self.git_dir)
+endfunction
+
+call s:add_methods('repo',['config'])
+
" Section: File API
function! s:DirCommitFile(path) abort