From 8425545087ccf297bb44a475f325033b5d86b61f Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Tue, 28 Apr 2026 11:13:23 +0200 Subject: [PATCH] feat(git): route :G cat-file -p through the object viewer --- lua/git/cmd.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/git/cmd.lua b/lua/git/cmd.lua index b934325..ad2dead 100644 --- a/lua/git/cmd.lua +++ b/lua/git/cmd.lua @@ -98,6 +98,17 @@ local function run_in_split(worktree, args, conf) end end + -- `cat-file -p ` routes to the gitobject viewer so commits get + -- the full message + diff view and other types render via cat-file. + -- Other modes (-t, -s, -e) fall through to the generic dump. + if args[1] == "cat-file" and vim.list_contains(args, "-p") then + local ref = first_positional(args, 2) + if ref then + require("git.object").open_object(worktree, ref) + return + end + end + local buf = git.new_scratch() vim.b[buf].git_worktree = worktree if conf.needs_ref then