refactor(git): extract util.split_lines helper
This commit is contained in:
+2
-5
@@ -1,6 +1,7 @@
|
||||
local diff = require("git.diff")
|
||||
local log = require("log")
|
||||
local repo = require("git.repo")
|
||||
local util = require("util")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -153,11 +154,7 @@ function M.open_commit(worktree, ref)
|
||||
log.error("git show %s failed: %s", ref, result.stderr or "")
|
||||
return
|
||||
end
|
||||
local content = result.stdout or ""
|
||||
local lines = vim.split(content, "\n", { plain = true, trimempty = false })
|
||||
if #lines > 0 and lines[#lines] == "" then
|
||||
table.remove(lines)
|
||||
end
|
||||
local lines = util.split_lines(result.stdout or "")
|
||||
local sha = repo.rev_parse(worktree, ref, true) or ref
|
||||
local parent = repo.rev_parse(worktree, ref .. "^", true)
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
|
||||
Reference in New Issue
Block a user