Skip to content

Git console doesn't open when hook fails #1652

@pipoprods

Description

@pipoprods

Description

Hi,

The Git console doesn't open when a hook fails. There's no user feedback at all indicating something failed.

Example minimal git hook provided in minimal config section.

Neovim version

NVIM v0.10.4
Build type: Release
LuaJIT 2.1.1713484068

Operating system and version

Debian 12

Steps to reproduce

  1. nvim -u ./minimal.lua
  2. add files to stage
  3. try to commit
  4. nothing happens (normal), no message is displayed

Expected behavior

The console should auto-open to let the user see the hook output.

Actual behavior

The hook output is not displayed.

Minimal config

Minimal setup:

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"https://github.com/folke/lazy.nvim.git",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	"NeogitOrg/neogit",
	dependencies = {
		"nvim-lua/plenary.nvim", -- required
		"nvim-telescope/telescope.nvim", -- optional
		"sindrets/diffview.nvim", -- optional
	},
	config = function()
		require("neogit").setup({})
	end,
})

.git/hooks/commit-msg:

#!/bin/sh

echo "Hook failed"
exit 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions