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>,
	Chandra Kethi-Reddy <chandrakr@pm•me>,
	Chandra Kethi-Reddy <chandrakr@pm•me>
Subject: Re: [PATCH v4] add: support pre-add hook
Date: Thu, 05 Mar 2026 14:03:44 +0200	[thread overview]
Message-ID: <87seaexz33.fsf@gentoo.mail-host-address-is-not-set> (raw)
In-Reply-To: <pull.2045.v4.git.1772710566599.gitgitgadget@gmail.com>

Hi Chandra,

On Thu, 05 Mar 2026, "Chandra Kethi-Reddy via GitGitGadget" <gitgitgadget@gmail•com> wrote:
> @@ -576,6 +582,11 @@ int cmd_add(int argc,
>  		string_list_clear(&only_match_skip_worktree, 0);
>  	}
>  
> +	if (!show_only && !no_verify && find_hook(repo, "pre-add")) {
> +		run_pre_add = 1;
> +		orig_index_path = absolute_pathdup(repo_get_index_file(repo));
> +	}
> +

Please use hook_exists() instead of find_hook() because that works with
hooks defined via config files. Otherwise your hooks API usage is great.

Maybe add a test or two which define the pre-add hook via configs to
verify it works?

(regarding find_hook(), we sholud mark it as deprecated or convert all
its remaining uses and remove it, however that's outside the scope of
your series, no worries)

  reply	other threads:[~2026-03-05 12:03 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 [this message]
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
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=87seaexz33.fsf@gentoo.mail-host-address-is-not-set \
    --to=adrian.ratiu@collabora$(echo .)com \
    --cc=ben.knoble@gmail$(echo .)com \
    --cc=chandrakr@pm$(echo .)me \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitgitgadget@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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