git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Config options -c in rebase --continue not passed to prepare-commit-msg hook

From
Jeff King <peff@peff.net>
Date
Sep 5, 2025, 21:23 UTC
Message-ID
<20250905212321.GA612697@coredump.intra.peff.net>
In-Reply-To
<CANM0SV0+t7x_VTtZNCO8rKo1vvxhJjwEdmjLDN70njxCo7DofQ@mail.gmail.com>
On Thu, Sep 04, 2025 at 02:46:13PM +0200, Devste Devste wrote:
> For some reason neither environment variables nor -c is passed to the
> prepare-commit-msg hook when rebasing.
> Other parameters (e.g. -C /path/to/repo) are passed correctly/it's
> running the command in the correct repo

If the environment is being cleared, then that would explain "-c" as well, since it passes through the environment. However, I can't reproduce the problem here.

This is my full recipe:

-- >8 -- git init git checkout main echo base >file && git add file && git commit -m base echo main >>file && git commit -am main git checkout -b side HEAD^ echo side >>file && git commit -am side

cat >.git/hooks/prepare-commit-msg <<\EOF #!/bin/sh echo "in prepare-commit-msg hook" echo "FOO: $FOO" echo "config: $(git config --get hooks.foobar)" exit 1 EOF chmod +x .git/hooks/prepare-commit-msg

git rebase main echo resolved >file git add file FOO=bar git -c hooks.foobar=hello rebase --continue -- >8 --

The final command produces:
  in prepare-commit-msg hook
  FOO: bar
  config: hello
  error: could not commit staged changes.

which is what I'd expect. Do you get the same thing? If not, then I wonder what could be different between our environments. If so, then I wonder what is different from your earlier testing. :)

-Peff
Previous: Devste Devste
Message 2 of 2 in “Config options -c in rebase --continue not passed to prepare-commit-msg hook”
  1. Devste DevsteSep 4, 2025
  2. Jeff KingSep 5, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.