public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Ratiu <adrian.ratiu@collabora.com>
To: Chandra Kethi-Reddy via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Cc: Ben Knoble <ben.knoble@gmail.com>,
	Phillip Wood <phillip.wood123@gmail.com>,
	Chandra Kethi-Reddy <chandrakr@pm.me>,
	Chandra Kethi-Reddy <chandrakr@pm.me>
Subject: Re: [PATCH v5] add: support pre-add hook
Date: Thu, 05 Mar 2026 15:41:05 +0200	[thread overview]
Message-ID: <87o6l2xuku.fsf@collabora.com> (raw)
In-Reply-To: <pull.2045.v5.git.1772714253412.gitgitgadget@gmail.com>

Hi again Chandra,

On Thu, 05 Mar 2026, "Chandra Kethi-Reddy via GitGitGadget" <gitgitgadget@gmail.com> wrote:
> Range-diff vs v4:
>
>  1:  9383395bb0 ! 1:  fc58c4cba2 add: support pre-add hook
>      @@ builtin/add.c: int cmd_add(int argc,
>        		string_list_clear(&only_match_skip_worktree, 0);
>        	}
>        
>      -+	if (!show_only && !no_verify && find_hook(repo, "pre-add")) {
>      ++	if (!show_only && !no_verify && hook_exists(repo, "pre-add")) {
>       +		run_pre_add = 1;
>       +		orig_index_path = absolute_pathdup(repo_get_index_file(repo));
>       +	}
>      @@ t/t3706-pre-add-hook.sh (new)
>       +	git commit -m "initial"
>       +'
>       +
>      ++test_expect_success 'hook found via core.hooksPath' '
>      ++	test_when_finished "git reset --hard &&
>      ++			    rm -rf custom-hooks &&
>      ++			    git config --unset core.hooksPath" &&
>      ++	mkdir custom-hooks &&
>      ++	write_script custom-hooks/pre-add <<-\EOF &&
>      ++	echo invoked >hook-ran
>      ++	EOF
>      ++	git config core.hooksPath custom-hooks &&
>      ++	echo changed >>file &&
>      ++	git add file &&
>      ++	test_path_is_file hook-ran &&
>      ++	rm -f hook-ran
>      ++'

The test you added is rather surprising, was it written by Claude AI?

For clarification, what I asked for is to add tests which define the new
hook via configs like done in t1800-hook.sh tests, for example in your
case, you can define a simple test like this:

test_config hook.my-friendly-echo.event "pre-add" &&
test_config hook.my-friendly-echo.command "echo hello from hook" &&

See Documentation/config/hook.adoc for more details.

The turnaround in minutes between v4 -> v5 is also surprising.
Please give humans a chance to review & respond, at least a couple of
days between resvisions. :)

Thanks,
Adrian

  reply	other threads:[~2026-03-05 13:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10 15:32 [PATCH] add: support pre-add hook Chandra Kethi-Reddy via GitGitGadget
2026-02-10 18:16 ` Junio C Hamano
2026-02-10 19:00   ` Junio C Hamano
2026-02-11 15:16     ` [PATCH] " Chandra
2026-02-11 15:05 ` [PATCH v2] " Chandra Kethi-Reddy via GitGitGadget
2026-02-11 19:50   ` Junio C Hamano
2026-02-11 21:11     ` Chandra
2026-02-11 21:24       ` Junio C Hamano
2026-02-11 21:54         ` Chandra
2026-02-25  2:15           ` [PATCH v3] " Chandra
2026-02-27  5:54   ` Chandra Kethi-Reddy via GitGitGadget
2026-03-03 23:06     ` Junio C Hamano
2026-03-04  9:49       ` Ben Knoble
2026-03-05 10:47     ` Phillip Wood
2026-03-05 11:40       ` [PATCH v4] " Chandra
2026-03-05 14:48       ` [PATCH v3] " Junio C Hamano
2026-03-05 11:36     ` [PATCH v4] " Chandra Kethi-Reddy via GitGitGadget
2026-03-05 12:03       ` Adrian Ratiu
2026-03-05 12:37         ` Chandra
2026-03-05 12:37       ` [PATCH v5] " Chandra Kethi-Reddy via GitGitGadget
2026-03-05 13:41         ` Adrian Ratiu [this message]
2026-03-05 13:46           ` Chandra
2026-03-05 19:23           ` Junio C Hamano
2026-03-06  2:20             ` Chandra
2026-03-13 14:39               ` Phillip Wood
2026-03-05 14:37         ` Phillip Wood

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=87o6l2xuku.fsf@collabora.com \
    --to=adrian.ratiu@collabora.com \
    --cc=ben.knoble@gmail.com \
    --cc=chandrakr@pm.me \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=phillip.wood123@gmail.com \
    /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