Reduce fugitive#buffer() to stub object

This commit is contained in:
Tim Pope
2019-09-01 20:55:22 -04:00
parent c212d854d5
commit 251eda7eb6

View File

@@ -1385,43 +1385,15 @@ function! fugitive#buffer(...) abort
return buffer
endfunction
function! s:buffer_getvar(var) dict abort
throw "fugitive: A third-party plugin or vimrc is calling fugitive#buffer().getvar() which has been removed. Replace it with the local variable or getbufvar()"
endfunction
function! s:buffer_getline(lnum) dict abort
throw "fugitive: A third-party plugin or vimrc is calling fugitive#buffer().getline() which has been removed. Replace it with getline() or getbufline()"
endfunction
function! s:buffer_repo() dict abort
return fugitive#repo(self['#'])
endfunction
function! s:buffer_type(...) dict abort
return getbufvar(self['#'], 'fugitive_type')
return 'see b:fugitive_type'
endfunction
function! s:buffer_spec() dict abort
throw "fugitive: A third-party plugin or vimrc is calling fugitive#buffer().spec() which has been removed. Replace it with bufname(), expand('%:p'), etc"
endfunction
function! s:buffer_name() dict abort
throw "fugitive: A third-party plugin or vimrc is calling fugitive#buffer().name() which has been removed. Replace it with bufname(), expand('%:p'), etc"
endfunction
function! s:buffer_commit() dict abort
throw "fugitive: A third-party plugin or vimrc is calling fugitive#buffer().commit() which has been removed. Replace it with matchstr(FugitiveParse()[0], '^\x\+')"
endfunction
function! s:buffer_relative(...) dict abort
throw "fugitive: A third-party plugin or vimrc is calling fugitive#buffer().relative() which has been removed. Replace it with FugitivePath(@%, " . string(a:0 ? a:1 : '') . ")"
endfunction
function! s:buffer_path(...) dict abort
throw "fugitive: A third-party plugin or vimrc is calling fugitive#buffer().path() which has been removed. Replace it with FugitivePath(@%, " . string(a:0 ? a:1 : '') . ")"
endfunction
call s:add_methods('buffer',['getvar','getline','repo','type','spec','name','commit','path','relative'])
call s:add_methods('buffer', ['repo', 'type'])
" Section: Completion