feat(pickers): add opt.show_remote_tracking_branches to git_branches (#2314)
This commit is contained in:
@@ -1028,10 +1028,17 @@ builtin.git_branches({opts}) *telescope.builtin.git_branches()*
|
|||||||
{opts} (table) options to pass to the picker
|
{opts} (table) options to pass to the picker
|
||||||
|
|
||||||
Options: ~
|
Options: ~
|
||||||
{cwd} (string) specify the path of the repo
|
{cwd} (string) specify the path of the
|
||||||
{use_git_root} (boolean) if we should use git root as cwd or the cwd
|
repo
|
||||||
(important for submodule) (default: true)
|
{use_git_root} (boolean) if we should use git root
|
||||||
{pattern} (string) specify the pattern to match all refs
|
as cwd or the cwd
|
||||||
|
(important for submodule)
|
||||||
|
(default: true)
|
||||||
|
{show_remote_tracking_branches} (boolean) show remote tracking
|
||||||
|
branches like origin/main
|
||||||
|
(default: true)
|
||||||
|
{pattern} (string) specify the pattern to
|
||||||
|
match all refs
|
||||||
|
|
||||||
|
|
||||||
builtin.git_status({opts}) *telescope.builtin.git_status()*
|
builtin.git_status({opts}) *telescope.builtin.git_status()*
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ git.branches = function(opts)
|
|||||||
{ "git", "for-each-ref", "--perl", "--format", format, "--sort", "-authordate", opts.pattern },
|
{ "git", "for-each-ref", "--perl", "--format", format, "--sort", "-authordate", opts.pattern },
|
||||||
opts.cwd
|
opts.cwd
|
||||||
)
|
)
|
||||||
|
local show_remote_tracking_branches = vim.F.if_nil(opts.show_remote_tracking_branches, true)
|
||||||
|
|
||||||
local results = {}
|
local results = {}
|
||||||
local widths = {
|
local widths = {
|
||||||
@@ -225,7 +226,11 @@ git.branches = function(opts)
|
|||||||
}
|
}
|
||||||
local prefix
|
local prefix
|
||||||
if vim.startswith(entry.refname, "refs/remotes/") then
|
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
|
elseif vim.startswith(entry.refname, "refs/heads/") then
|
||||||
prefix = "refs/heads/"
|
prefix = "refs/heads/"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ builtin.git_bcommits = require_on_exported_call("telescope.builtin.__git").bcomm
|
|||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field cwd string: specify the path of the repo
|
---@field cwd string: specify the path of the repo
|
||||||
---@field use_git_root boolean: if we should use git root as cwd or the cwd (important for submodule) (default: true)
|
---@field use_git_root boolean: if we should use git root as cwd or the cwd (important for submodule) (default: true)
|
||||||
|
---@field show_remote_tracking_branches boolean: show remote tracking branches like origin/main (default: true)
|
||||||
---@field pattern string: specify the pattern to match all refs
|
---@field pattern string: specify the pattern to match all refs
|
||||||
builtin.git_branches = require_on_exported_call("telescope.builtin.__git").branches
|
builtin.git_branches = require_on_exported_call("telescope.builtin.__git").branches
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user