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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux