git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sam Newbold" <sam@rwsh.org>
To: "Taylor Blau" <me@ttaylorr.com>, phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org
Subject: Re: core.hooksPath cannot revert to the default locally
Date: Wed, 16 Oct 2024 20:36:08 -0400	[thread overview]
Message-ID: <38af2f33-f793-46f8-a0a0-c63ab70e764e@app.fastmail.com> (raw)
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:
> 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

      reply	other threads:[~2024-10-17  0:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16  6:26 core.hooksPath cannot revert to the default locally Sam Newbold
2024-10-16  9:03 ` Phillip Wood
2024-10-16 13:42   ` Phillip Wood
2024-10-16 20:33     ` Taylor Blau
2024-10-17  0:36       ` Sam Newbold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38af2f33-f793-46f8-a0a0-c63ab70e764e@app.fastmail.com \
    --to=sam@rwsh.org \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).