You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
counsel-git uses the git root directory relative to the default-directory of the buffer (counsel-git > counsel-locate-git-root > counsel--git-root > counsel--dominating-file). However, if the buffer corresponds to a file which resides in a submodule, performing a git ls-files search (via counsel-git) will only show results for the current submodule, but not the parent or sibling submodules. Ideally, there should be a way to adjust the search directory, but there is no keymap for invoking counsel-cd from within the minibuffer, such as there is for counsel-git-grep.
If we could navigate to the top-most directory, we could perform a search this way...or really at any level of the nested git repository. This is what is being requested...the ability to invoke counsel-cd from counsel-git. A workaround would be to open a buffer corresponding to a file in the top-level git repository, however it is a nuisance to do this, and counsel-git-grep does not require this...it allows changing the directory. Thus, for a similar scenario (involving grep instead of find file) using counsel-git-grep it is straight forward (assuming "submodule.recurse=true" is configured for the repository) by just invoking C-x C-d from within the minibuffer and changing the directory up to the top-level directory.
For counsel-git, it could be as easy as it is for counsel-git-grep if counsel-cd were allowed to be invoked. One additional caveat to note is that git ls-files ignores the git config value of "submodule.recurse", apparently purposefully, as indicated here. However, this can be worked around by overriding the value of counsel-git-cmd and explicitly adding the "--recurse-submodules" option to that string.
The following is a test scenario which demonstrates the problem.
counsel-git
uses the git root directory relative to thedefault-directory
of the buffer (counsel-git
>counsel-locate-git-root
>counsel--git-root
>counsel--dominating-file
). However, if the buffer corresponds to a file which resides in a submodule, performing agit ls-files
search (viacounsel-git
) will only show results for the current submodule, but not the parent or sibling submodules. Ideally, there should be a way to adjust the search directory, but there is no keymap for invokingcounsel-cd
from within the minibuffer, such as there is forcounsel-git-grep
.If we could navigate to the top-most directory, we could perform a search this way...or really at any level of the nested git repository. This is what is being requested...the ability to invoke
counsel-cd
fromcounsel-git
. A workaround would be to open a buffer corresponding to a file in the top-level git repository, however it is a nuisance to do this, andcounsel-git-grep
does not require this...it allows changing the directory. Thus, for a similar scenario (involving grep instead of find file) usingcounsel-git-grep
it is straight forward (assuming "submodule.recurse=true" is configured for the repository) by just invokingC-x C-d
from within the minibuffer and changing the directory up to the top-level directory.For
counsel-git
, it could be as easy as it is forcounsel-git-grep
ifcounsel-cd
were allowed to be invoked. One additional caveat to note is thatgit ls-files
ignores the git config value of "submodule.recurse", apparently purposefully, as indicated here. However, this can be worked around by overriding the value ofcounsel-git-cmd
and explicitly adding the "--recurse-submodules" option to that string.The following is a test scenario which demonstrates the problem.
git Test Repository Scenario
Test Scenario
make plain
C-x C-f ~/git/test-counsel-git/X/test_x.txt
M-x counsel-git test
C-x C-f ~/git/test-counsel-git/test_main.txt
M-x counsel-git test
git ls-files
does not recurse through submodules).M-: (setq counsel-git-cmd "git ls-files --recurse-submodules -z --full-name --")
counsel-git-cmd
to add the--recurse-submodules
optionM-x counsel-git test
C-x b test_x.txt
M-x counsel-git test
The text was updated successfully, but these errors were encountered: