ludovicchabant / vim-gutentags

A Vim plugin that manages your tag files
https://bolt80.com/gutentags/
MIT License
2.3k stars 175 forks source link

changing g:gutentags_ctags_tagfile causes broken tags file #239

Closed crichardson332 closed 4 years ago

crichardson332 commented 5 years ago

Describe the bug I'm trying to have gutengtags put the generated tags file into the .git directory. By default, it creates a tags file in the project root, which causes untracked files in git for every single repository, which in my case is many. However, when I change g:gutentags_ctags_tagfile to '.git/tags', according to this thread, the relative paths in the resulting tags file are missing the "../" needed to move out of the ".git" directory (for example, it contains src/module/file.cpp). Vim then tries to look for ".git/src/module/file.cpp" and fails.

Steps to reproduce

Share your setup

Post the logs Messages maintainer: Bram Moolenaar Bram@vim.org "src/plugins/sensor/RayTrace/RayTrace.cpp" 91L, 3303C gutentags: Scanning buffer 'src/plugins/sensor/RayTrace/RayTrace.cpp' for gutentags setup... gutentags: No specific project type. gutentags: Setting gutentags for buffer 'src/plugins/sensor/RayTrace/RayTrace.cpp' gutentags: Generating tags file: /home/crichardson/gtri_repos/scrimmage/.git/tags gutentags: Wildignore options file is up to date. gutentags: Running: ['/home/crichardson/.vim/pack/crich/start/vim-gutentags/plat/unix/update_tags.sh', '-e', 'ctags', '-t', '.git/tags', '-p', '.', '-o', '/home/crichardson/.vim/pack/crich/start/vim-gutentags/re s/ctags_recursive.options', '-l', '.git/tags.log'] gutentags: In: /home/crichardson/gtri_repos/scrimmage gutentags: [job output]: 'Locking tags file...' gutentags: [job output]: 'Running ctags on whole project' gutentags: [job output]: 'ctags -f ".git/tags.temp" --options=/home/crichardson/.vim/pack/crich/start/vim-gutentags/res/ctags_recursive.options .' gutentags: [job output]: 'Replacing tags file' gutentags: [job output]: 'mv -f ".git/tags.temp" ".git/tags"' gutentags: [job output]: 'Unlocking tags file...' gutentags: [job output]: 'Done.' gutentags: Finished ctags job. whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long whitespace/line_length: Lines should be <= 80 characters long File ".git/include/scrimmage/math/Angles.h" does not exist tag 2 of 3 or more File ".git/src/math/Angles.cpp" does not exist tag 3 of 3 or more tag 3 of 3

ludovicchabant commented 4 years ago

Should be fixed with aa67e48f6c071ef4179dc30ac24ddf93e5eb6338, thanks!

piever commented 4 years ago

I'm experiencing the same bug (with the same config as the OP, but on neovim and on Ubuntu 19.10: I use the gutentags plugin in combination with vimtex, not sure whether that's relevant). I've tried checking out past commits and, at least in my case, the bug was fixed by https://github.com/ludovicchabant/vim-gutentags/commit/aa67e48f6c071ef4179dc30ac24ddf93e5eb6338, and then reintroduced by https://github.com/ludovicchabant/vim-gutentags/commit/259a45af1b015addc9e17799e7c6caf982bd5b71.