Try harder not to choke on broken modeline

Partially addresses #162.
This commit is contained in:
Tim Pope
2012-03-05 07:19:31 -05:00
parent 5be0c6850e
commit 5bc125d1d5

View File

@@ -1283,7 +1283,7 @@ endfunction
call s:add_methods('buffer',['compare_age'])
function! s:Diff(bang,...) abort
function! s:Diff(bang,...)
let split = a:bang ? 'split' : 'vsplit'
if exists(':DiffGitCached')
return 'DiffGitCached'
@@ -1930,10 +1930,13 @@ function! s:BufReadIndexFile()
try
let b:fugitive_type = 'blob'
let b:git_dir = s:repo().dir()
try
call s:ReplaceCmd(s:repo().git_command('cat-file','blob',s:buffer().sha1()))
finally
if &bufhidden ==# ''
setlocal bufhidden=delete
endif
endtry
return ''
catch /^fugitive: rev-parse/
silent exe 'doau BufNewFile '.s:fnameescape(bufname(''))
@@ -1998,6 +2001,7 @@ function! s:BufReadObject()
silent %delete
setlocal endofline
try
if b:fugitive_type == 'tree'
let b:fugitive_display_format = b:fugitive_display_format % 2
if b:fugitive_display_format
@@ -2032,6 +2036,7 @@ function! s:BufReadObject()
elseif b:fugitive_type ==# 'blob'
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
endif
finally
call setpos('.',pos)
setlocal ro noma nomod
if &bufhidden ==# ''
@@ -2044,6 +2049,7 @@ function! s:BufReadObject()
else
call s:JumpInit()
endif
endtry
return ''
catch /^fugitive:/