Revert "feat(git): git_commits shows the current branch graph (#2288)" (#2358)

This reverts commit 01d92285ef.
This commit is contained in:
Simon Hauser
2023-01-31 08:24:16 +01:00
committed by GitHub
parent f4b0438983
commit 203bf56091
2 changed files with 7 additions and 16 deletions

View File

@@ -56,7 +56,7 @@ end
git.commits = function(opts) git.commits = function(opts)
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_commits(opts)) opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_commits(opts))
local git_command = vim.F.if_nil(opts.git_command, { "git", "log", "--graph", "--oneline", "--decorate", "--", "." }) local git_command = vim.F.if_nil(opts.git_command, { "git", "log", "--pretty=oneline", "--abbrev-commit", "--", "." })
pickers pickers
.new(opts, { .new(opts, {
@@ -115,7 +115,8 @@ git.bcommits = function(opts)
opts.current_line = (opts.current_file == nil) and get_current_buf_line(opts.winnr) or nil opts.current_line = (opts.current_file == nil) and get_current_buf_line(opts.winnr) or nil
opts.current_file = vim.F.if_nil(opts.current_file, vim.api.nvim_buf_get_name(opts.bufnr)) opts.current_file = vim.F.if_nil(opts.current_file, vim.api.nvim_buf_get_name(opts.bufnr))
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_commits(opts)) opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_commits(opts))
local git_command = vim.F.if_nil(opts.git_command, { "git", "log", "--graph", "--oneline", "--decorate", "--follow" }) local git_command =
vim.F.if_nil(opts.git_command, { "git", "log", "--pretty=oneline", "--abbrev-commit", "--follow" })
pickers pickers
.new(opts, { .new(opts, {

View File

@@ -430,27 +430,17 @@ function make_entry.gen_from_git_commits(opts)
return nil return nil
end end
local marker, sha, msg = string.match(entry, "([*\\/| ]+) +([0-9a-f]*) +(.*)") local sha, msg = string.match(entry, "([^ ]+) (.+)")
if not sha then
marker = entry
sha = ""
msg = ""
end
if not msg then if not msg then
sha = entry
msg = "<empty commit message>" msg = "<empty commit message>"
end end
marker, _ = string.gsub(marker, "\\", "+")
marker, _ = string.gsub(marker, "/", "-")
marker, _ = string.gsub(marker, "+", "/")
marker, _ = string.gsub(marker, "-", "\\")
return make_entry.set_default_entry_mt({ return make_entry.set_default_entry_mt({
value = sha, value = sha,
ordinal = marker .. " " .. sha .. " " .. msg, ordinal = sha .. " " .. msg,
msg = marker .. " " .. msg, msg = msg,
display = make_display, display = make_display,
current_file = opts.current_file, current_file = opts.current_file,
}, opts) }, opts)