feat: support <pattern> for git-for-each-ref (git_branches) (#1248)

This commit is contained in:
Anthony Nichols
2021-09-16 04:58:59 -05:00
committed by GitHub
parent 2c71ffec07
commit 5f0ccf1346
3 changed files with 6 additions and 1 deletions

View File

@@ -812,6 +812,7 @@ builtin.git_branches({opts}) *builtin.git_branches()*
{cwd} (string) specify the path of the repo {cwd} (string) specify the path of the repo
{use_git_root} (boolean) if we should use git root as cwd or the cwd {use_git_root} (boolean) if we should use git root as cwd or the cwd
(important for submodule) (default: true) (important for submodule) (default: true)
{pattern} (string) specify the pattern to match all refs
builtin.git_status({opts}) *builtin.git_status()* builtin.git_status({opts}) *builtin.git_status()*

View File

@@ -195,7 +195,10 @@ git.branches = function(opts)
.. "%(authorname)" .. "%(authorname)"
.. "%(upstream:lstrip=2)" .. "%(upstream:lstrip=2)"
.. "%(committerdate:format-local:%Y/%m/%d %H:%M:%S)" .. "%(committerdate:format-local:%Y/%m/%d %H:%M:%S)"
local output = utils.get_os_command_output({ "git", "for-each-ref", "--perl", "--format", format }, opts.cwd) local output = utils.get_os_command_output(
{ "git", "for-each-ref", "--perl", "--format", format, opts.pattern },
opts.cwd
)
local results = {} local results = {}
local widths = { local widths = {

View File

@@ -182,6 +182,7 @@ builtin.git_bcommits = require_on_exported_call("telescope.builtin.git").bcommit
---@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 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
--- Lists git status for current directory --- Lists git status for current directory