From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 1E1BB1F619 for ; Fri, 13 Mar 2020 17:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726865AbgCMR5E (ORCPT ); Fri, 13 Mar 2020 13:57:04 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:51577 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726480AbgCMR5D (ORCPT ); Fri, 13 Mar 2020 13:57:03 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id DACB258871; Fri, 13 Mar 2020 13:57:00 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=ZMaCGaBm95oJPTnBrjfEeilAP7E=; b=X8+n2V iI2a/waZn1YR9XDNzwfvZ9mJy0PjU8r3FNcOPSBfwDMgThJQTkD3tn80PAY24RWn w2PeuLRgyZp1Qznn0pagg5Oy2gAiciIyEa5SnGVxpqJdXT56CsU8rgCQ9hNwPYVv gqMsWki6+VTQbtEp/o/qFtFt0xYBceEwKOYmU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=CL6icxplo/Qy6gVmbNKHouk2BqtkHdWF x4JilgxOSx9BLq9jD07yncBVZOAGWf1JBP2TtJwisRIIZqKCupnHcD7ZfWttMCfA T1aflujax54NFoa1NG1EfGsivjvcEg5Bok7p9e7xxVqKgu1+NaSJ+qqLmtKVwusC 6U+vOxO87T8= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id C879B58870; Fri, 13 Mar 2020 13:57:00 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.74.119.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 304855886F; Fri, 13 Mar 2020 13:57:00 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Emily Shaffer Cc: James Ramsay , git@vger.kernel.org Subject: Re: [TOPIC 2/17] Hooks in the future References: <0D7F1872-7614-46D6-BB55-6FEAA79F1FE6@jramsay.com.au> <20200312141628.GL212281@google.com> Date: Fri, 13 Mar 2020 10:56:59 -0700 In-Reply-To: <20200312141628.GL212281@google.com> (Emily Shaffer's message of "Thu, 12 Mar 2020 07:16:28 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 09AC2D40-6554-11EA-BC28-C28CBED8090B-77302942!pb-smtp1.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Emily Shaffer writes: > This means that we could do something like this: > > [hook "/path/to/executable.sh"] > event = pre-commit > order = 123 > mustSucceed = false > parallelizable = true > > etc, etc as needed. You can do [hook "pre-commit"] order = 123 path = "/path/to/executable.sh" [hook "pre-commit"] order = 234 path = "/path/to/another-executable.sh" as well, and using the second level for what hook the (sub)section is about, instead of "we have this path that is used for a hook. What hook is it?", feels (at least to me) more natural. > But I wonder if we also want to be able to do something like this: > > [hook "/etc/git-secrets/git-secrets"] > event = pre-commit > event = prepare-commit-msg Once you start going this route, it no longer makes sense to give priority (you called it "order") to a path and have that same number used in contexts of different hooks. Your git-secrets script may want to be called early among pre-commit hooks but late among the prepare-commit-msg hooks, for example. > I think, though, that something like > hook.pre-commit."path/to/executable.sh" won't work. That is why Peff already suggested in the TOPIC notes to use "command" in the message you are responding to (I used "path" in the above description).