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

Re: core.hooksPath cannot revert to the default locally

From
SNSam Newbold <sam@rwsh.org>
Date
Oct 17, 2024, 00:36 UTC
Message-ID
<38af2f33-f793-46f8-a0a0-c63ab70e764e@app.fastmail.com>
In-Reply-To
<ZxAjLrrqM5i2kdBz@nand.local>
Great! I'll reply to this thread when I have some code to be reviewed.
On Wed, Oct 16, 2024, at 16:33, Taylor Blau wrote:
Show 34 quoted lines
> On Wed, Oct 16, 2024 at 02:42:57PM +0100, Phillip Wood wrote:
>> On 16/10/2024 10:03, Phillip Wood wrote:
>> > I'm pretty sure I've used "git -c core.hookspath=/dev/null ..."
>>
>> Looking at the code that will unfortunately disable all hooks including
>> the ones in .git/hooks. It would make sense to allow an empty
>> core.hooksPath mean "use .git/hooks". If you're interested in working
>> on this then I think doing something like
>
> Thanks for providing a helpful suggestion.
>
> I agree that the behavior you suggested here when specifying an empty
> value for 'core.hooksPath' would be an improvement here as a means to
> override system/global-level configuration.
>
>> diff --git a/config.c b/config.c
>> index a11bb85da30..91f190a1ce1 100644
>> --- a/config.c
>> +++ b/config.c
>> @@ -1437,7 +1437,10 @@ static int git_default_core_config(const char *var, const char *value,
>>          if (!strcmp(var, "core.hookspath")) {
>>                  FREE_AND_NULL(git_hooks_path);
>> -                return git_config_pathname(&git_hooks_path, var, value);
>> +                if (value)
>
> I think this should read "if (value && *value)" instead, to ensure that
> things like:
>
>     git -c core.hooksPath= ...
>
> work as expected.
>
> Thanks,
> Taylor
Previous: Taylor Blau
Message 5 of 5 in “core.hooksPath cannot revert to the default locally”
  1. Sam NewboldOct 16, 2024
  2. Phillip WoodOct 16, 2024
  3. Phillip WoodOct 16, 2024
  4. Taylor BlauOct 16, 2024
  5. Sam NewboldOct 17, 2024

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.