-
-
Notifications
You must be signed in to change notification settings - Fork 826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git_files shows submodules #410
Comments
Okay i see what you are saying. The bug, why its crashing, is in plenary so i messed up something there :| There is a PR #329 which allows you to display submodules content but thats not what you expect so i was planing to do a ls for The easy way would be to just run ls but i think we can do this just with Maybe that will help in the future because i am not sure if we can realize that submodules are not shown at all. Edit: Fix for the crash is here nvim-lua/plenary.nvim#47. CI is currently broken because we can't find a nightly image. Vanished again :| |
Ah, word. I searched issues, but I guess I forgot to search PRs. Looks like you've got adherence to gitignore in there too. Kudos. Bummer about the CI. |
No worries. Still grateful about the issue. Didn't know that directory was crashing again. CI comes back :) just need a nvim nightly image on github to pull. The original plan with my PR was to have a fd replacement written in lua and I am planing to finish that directory previewer over the next week. I just pushed a first draft and updated the PR description with a preview of the output. Hardest part is converting the uid / gid to the actual name without leaving lua land and running |
Roger that. For the time being (and for anyone else who runs across this), I'm able to get what I want (git repo files sans submodules with the new buffer preview) easily enough by writing a quick project files picker function that just uses the regular local M = {}
...
M.project_files = function()
require("telescope.builtin").find_files {
cwd = require("lspconfig.util").root_pattern(".git")(vim.fn.expand("%:p"))
}
end I just used The bee's knees would probably be:
|
Okay i think we are done with this now. We can list submodules and show dirs in the buffer previewer. About your point of fallback to find_files if no git repo you can write that function: M.project_files = function()
local opts = {} -- define here if you want to define something
local ok = pcall(require'telescope.builtin'.git_files, opts)
if not ok then
require'telescope.builtin'.find_files(opts)
end
end Thanks for reporting and your insight :) Closing for now. Feel free to reopen if anything is left :) |
Hmmm. After updating, I'm actually getting this for
|
Should at least fix it but there is another issue. You are on a mac right? Accordning to google i can't read passwd for the usernames and ids :| So i can go from id to name. Didn't know about that 😆 I do some more digging later today. Sorry for the inconvenience :) |
I doing another confident close here. Hopefully that doesn't jinx it 😆 Thanks for the testing @timbedard :) |
Thanks for the good work! 😁 |
The fallback to find_files if no git repo is found seems to no longer work:
|
@motorto @Conni2461 See #2183 |
@bangedorrunt Thanks the workaround indeed works, update the recipe on the wiki so that no one stumbles on this again would be appreciated |
Description
The
git_files
picker shows git submodules. This is both annoying and can break previewers that are expecting to act only on files, such as the newvim_buffer_cat
previewer.I haven't found a suitable option for
git ls-files
or an alternative single command that gives us what we want, so we might just need to filter out the submodules from the list. From cursory exploration, it looks like we can use the output ofgit submodule status
or just parse.gitmodules
to determine what the submodules for the repo are.Alternatively,
git grep --exclude-standard --cached --untracked -l ""
comes really close, but excludes empty files and symlinks as well.Expected Behavior
The
git_files
picker does not show git submodules.Actual Behavior
The
git_files
picker shows git submodules.Details
Reproduce
:Telescope git_files
Environment
Configuration
(default)
The text was updated successfully, but these errors were encountered: