From: Junio C Hamano Date: Thu, 05 Mar 2026 14:48:24 GMT Subject: Re: [PATCH v3] add: support pre-add hook Message-ID: <87h5qujps7.fsf@gitster.g> In-Reply-To: <27ee9a9c-0caa-4b6e-a968-51c71c8b6e5f@gmail.com> Phillip Wood writes: > paths that are staged by the current invocation of "git add". That means > if for some reason I need to bypass the hook when running "git add" I'll > have to bypass it every time until I commit and cannot check the other > changes that I'm staging. It also means that running "git add" several > times, each with a different path runs the hook multiple times on the > same content. Correct. You'd need "git diff --name-only HEAD" twice and run the results through "comm -13" or something. > These caveats are rather unfortunate as it means to be sure that staged > changes get checked I have to duplicate the "pre-add" checks in the > "pre-commit" hook which is rather inefficient. It would be very nice to > be able to check changes as they're staged rather than just before they > are committed but I can't help feeling that what's proposed here is > driven by ease of implementation which leads to a rather incoherent user > experience. True. As I already said, I am not sure of the value of the proposed hook. Thanks.