From 11f89ba7494a03e6b0a9296b8393240d40dcc811 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 6 Jul 2014 00:20:19 -0400 Subject: [PATCH] Only change 'tags' if tags file exists Closes #402. References #426. --- plugin/fugitive.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index b60f206..abb27e0 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -185,9 +185,11 @@ function! fugitive#detect(path) abort if expand('%:p') =~# '//' call buffer.setvar('&path', s:sub(buffer.getvar('&path'), '^\.%(,|$)', '')) endif - if stridx(buffer.getvar('&tags'), escape(b:git_dir.'/tags', ', ')) == -1 - call buffer.setvar('&tags', escape(b:git_dir.'/tags', ', ').','.buffer.getvar('&tags')) - if &filetype !=# '' + if stridx(buffer.getvar('&tags'), escape(b:git_dir, ', ')) == -1 + if filereadable(b:git_dir.'/tags') + call buffer.setvar('&tags', escape(b:git_dir.'/tags', ', ').','.buffer.getvar('&tags')) + endif + if &filetype !=# '' && filereadable(b:git_dir.'/'.&filetype.'.tags') call buffer.setvar('&tags', escape(b:git_dir.'/'.&filetype.'.tags', ', ').','.buffer.getvar('&tags')) endif endif