comparison autoload/gutentags/ctags.vim @ 181:0b4ccd0deceb

Fix broken test for whether the tag file is inside the project root.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 23 Mar 2017 17:38:14 -0700
parents 411f3fa915f5
children 3cd4597fb86b
comparison
equal deleted inserted replaced
180:8bac4b955c84 181:0b4ccd0deceb
67 " these things. 67 " these things.
68 let l:prev_cwd = getcwd() 68 let l:prev_cwd = getcwd()
69 call gutentags#chdir(fnameescape(a:proj_dir)) 69 call gutentags#chdir(fnameescape(a:proj_dir))
70 70
71 let l:tags_file_exists = filereadable(a:tags_file) 71 let l:tags_file_exists = filereadable(a:tags_file)
72 let l:tags_file_is_local = match(a:tags_file, '\v[/\\]') < 0 72 let l:tags_file_relative = fnamemodify(a:tags_file, ':.')
73 let l:tags_file_is_local = len(l:tags_file_relative) < len(a:tags_file)
73 74
74 if l:tags_file_exists && g:gutentags_ctags_check_tagfile 75 if l:tags_file_exists && g:gutentags_ctags_check_tagfile
75 let l:first_lines = readfile(a:tags_file, '', 1) 76 let l:first_lines = readfile(a:tags_file, '', 1)
76 if len(l:first_lines) == 0 || stridx(l:first_lines[0], '!_TAG_') != 0 77 if len(l:first_lines) == 0 || stridx(l:first_lines[0], '!_TAG_') != 0
77 call gutentags#throwerr( 78 call gutentags#throwerr(
89 " Note that if we don't do this and pass a full path for the project 90 " Note that if we don't do this and pass a full path for the project
90 " root, some `ctags` implementations like Exhuberant Ctags can get 91 " root, some `ctags` implementations like Exhuberant Ctags can get
91 " confused if the paths have spaces -- but not if you're *in* the root 92 " confused if the paths have spaces -- but not if you're *in* the root
92 " directory, for some reason... 93 " directory, for some reason...
93 let l:actual_proj_dir = '.' 94 let l:actual_proj_dir = '.'
94 let l:actual_tags_file = fnamemodify(a:tags_file, ':.') 95 let l:actual_tags_file = l:tags_file_relative
95 call gutentags#chdir(fnameescape(a:proj_dir)) 96 call gutentags#chdir(fnameescape(a:proj_dir))
96 else 97 else
97 " else: the tags file goes in a cache directory, so we need to specify 98 " else: the tags file goes in a cache directory, so we need to specify
98 " all the paths absolutely for `ctags` to do its job correctly. 99 " all the paths absolutely for `ctags` to do its job correctly.
99 let l:actual_proj_dir = a:proj_dir 100 let l:actual_proj_dir = a:proj_dir