summaryrefslogtreecommitdiff
path: root/lua/telescope/builtin/git.lua
diff options
context:
space:
mode:
authorMassimo Redaelli <massimo@typish.io>2021-01-16 11:07:21 +0000
committerGitHub <noreply@github.com>2021-01-16 12:07:21 +0100
commit9f58834d04eca69600c132fe4600bbccf7bb9463 (patch)
tree734a7576c7d207b3ca19955003be89f429fba784 /lua/telescope/builtin/git.lua
parentc50c69ac0076224bfca90cca68fe480c30671896 (diff)
feat: allow to list files in git submodules (#329)
Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
Diffstat (limited to 'lua/telescope/builtin/git.lua')
-rw-r--r--lua/telescope/builtin/git.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/lua/telescope/builtin/git.lua b/lua/telescope/builtin/git.lua
index c30625e..a33e76b 100644
--- a/lua/telescope/builtin/git.lua
+++ b/lua/telescope/builtin/git.lua
@@ -11,6 +11,10 @@ local git = {}
git.files = function(opts)
local show_untracked = utils.get_default(opts.show_untracked, true)
+ local recurse_submodules = utils.get_default(opts.recurse_submodules, false)
+ if show_untracked and recurse_submodules then
+ error("Git does not suppurt both --others and --recurse-submodules")
+ end
-- By creating the entry maker after the cwd options,
-- we ensure the maker uses the cwd options when being created.
@@ -19,7 +23,11 @@ git.files = function(opts)
pickers.new(opts, {
prompt_title = 'Git File',
finder = finders.new_oneshot_job(
- { "git", "ls-files", "--exclude-standard", "--cached", show_untracked and "--others" },
+ vim.tbl_flatten( {
+ "git", "ls-files", "--exclude-standard", "--cached",
+ show_untracked and "--others" or nil,
+ recurse_submodules and "--recurse-submodules" or nil
+ } ),
opts
),
previewer = conf.file_previewer(opts),