Fix incorrect usage of readfile()

This commit is contained in:
Tim Pope
2012-04-03 06:52:48 -04:00
parent 89e771ea96
commit 39012290b8

View File

@@ -118,7 +118,7 @@ function! fugitive#extract_git_dir(path) abort
elseif type ==# 'link' && fugitive#is_git_dir(dir) elseif type ==# 'link' && fugitive#is_git_dir(dir)
return resolve(dir) return resolve(dir)
elseif type !=# '' && filereadable(dir) elseif type !=# '' && filereadable(dir)
let line = get(readfile(dir, 1), 0, '') let line = get(readfile(dir, '', 1), 0, '')
if line =~# '^gitdir: ' && fugitive#is_git_dir(line[8:-1]) if line =~# '^gitdir: ' && fugitive#is_git_dir(line[8:-1])
return line[8:-1] return line[8:-1]
endif endif
@@ -199,7 +199,7 @@ function! s:repo_configured_tree() dict abort
if !has_key(self,'_tree') if !has_key(self,'_tree')
let self._tree = '' let self._tree = ''
if filereadable(self.dir('config')) if filereadable(self.dir('config'))
let config = readfile(self.dir('config'),10) let config = readfile(self.dir('config'),'',10)
call filter(config,'v:val =~# "^\\s*worktree *="') call filter(config,'v:val =~# "^\\s*worktree *="')
if len(config) == 1 if len(config) == 1
let self._tree = matchstr(config[0], '= *\zs.*') let self._tree = matchstr(config[0], '= *\zs.*')