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