Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

find_git_root doesn't work for submodules #164

Closed
gitbugr opened this issue Dec 15, 2019 · 3 comments · Fixed by #175
Closed

find_git_root doesn't work for submodules #164

gitbugr opened this issue Dec 15, 2019 · 3 comments · Fixed by #175
Labels
bug Something isn't working
Milestone

Comments

@gitbugr
Copy link

gitbugr commented Dec 15, 2019

Environment (please complete the following information):

  • OS: Mac OS 10.15.1
  • (Neo)Vim version: NVIM v0.5.0-nightly-851-g6e8c5779c
  • vim-clap version: a2ee49e
  • Have you reproduced with a minimal vimrc: n/a

Describe the bug
for git submodules, the .git/ folder is actually a file.

To Reproduce
Steps to reproduce the behavior:

  1. Use any vim-clap configuration.

  2. Create a git project git --init

  3. Pull in your git submodule git submodule add https://github.com/liuchengxu/vim-clap

  4. Pull in another git submodule git submodule add https://github.com/liuchengxu/vim-which-key

  5. cd into the submodule you want to work on cd vim-clap

  6. Open vim and search for a file Clap files - you will notice files from your other submodule

  7. Check the git root echo clap#util#find_git_root(g:clap.start.bufnr) - the root is the parent repo. This is wrong.

Expected behavior
The git root should point to your submodule.

To fix this temporarily, I replaced the usages of clap#util#find_git_root(g:clap.start.bufnr) in autoload/clap/rooter.vim with the old clap#util#get_git_root()

@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.96. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@issue-label-bot issue-label-bot bot added the bug Something isn't working label Dec 15, 2019
@liuchengxu
Copy link
Owner

liuchengxu commented Dec 16, 2019

Seemingly it's not easy to find the git root manually, even though that could be much faster than using the system call. If so, I think we should just stick to clap#util#get_git_root(), which takes about 200ms on my machine, I can live with that.

liuchengxu added a commit that referenced this issue Dec 17, 2019
@liuchengxu
Copy link
Owner

liuchengxu commented Dec 17, 2019

Please see this branch fixes this issue, @gitbugr . I borrowed the strategy of vim-rooter, hoping that's robust enough, at least for the submodule case :(.

@liuchengxu liuchengxu added this to the 0.5 milestone Jan 11, 2020
liuchengxu added a commit that referenced this issue Jan 11, 2020
* Fix git submodule detection

Close #164

* Split out path.vim

* Fix CI

* Update CHANGELOG.md
liuchengxu pushed a commit that referenced this issue Aug 17, 2021
* first draft of the delmonicos review

* finalise the delmonicos evaluation post discussion
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants