From 1ba7278cf08da8048e7f589ef6b65a39fd3e4dbf Mon Sep 17 00:00:00 2001 From: Matt Taylor Date: Wed, 11 Jan 2023 06:00:44 -0800 Subject: feat(pickers): add opt.show_remote_tracking_branches to git_branches (#2314) --- lua/telescope/builtin/__git.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lua/telescope/builtin/__git.lua') diff --git a/lua/telescope/builtin/__git.lua b/lua/telescope/builtin/__git.lua index 737ad26..866934f 100644 --- a/lua/telescope/builtin/__git.lua +++ b/lua/telescope/builtin/__git.lua @@ -203,6 +203,7 @@ git.branches = function(opts) { "git", "for-each-ref", "--perl", "--format", format, "--sort", "-authordate", opts.pattern }, opts.cwd ) + local show_remote_tracking_branches = vim.F.if_nil(opts.show_remote_tracking_branches, true) local results = {} local widths = { @@ -225,7 +226,11 @@ git.branches = function(opts) } local prefix if vim.startswith(entry.refname, "refs/remotes/") then - prefix = "refs/remotes/" + if show_remote_tracking_branches then + prefix = "refs/remotes/" + else + return + end elseif vim.startswith(entry.refname, "refs/heads/") then prefix = "refs/heads/" else -- cgit v1.2.3