git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Alexander Potashev <aspotashev@gmail.com>
Cc: Marc Weber <marco-oweber@gmx.de>,
	git@vger.kernel.org, Rogan Dawes <lists@dawes.za.net>,
	martin f krafft <madduck@madduck.net>
Subject: Re: What about allowing multiple hooks?
Date: Sun, 04 Jan 2009 02:01:33 -0800	[thread overview]
Message-ID: <7vd4f3z8xu.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20090103233252.GA12095@myhost

Alexander Potashev <aspotashev@gmail.com> writes:

>> Thoughts?

I deliberately omitted support for multiple scripts in core git Porcelains
to avoid this exact issue.  It is a huge can of worms and it is dubious if
you can have a coherent and generic enough semantics.

In the meantime, you can have a single .git/hooks/pre-commit script that
defines your own convention.  Maybe it uses .git/hooks/pre-commit.d/
directory, full of scripts, and implements the semantics you want,
including:

 (1) the execution order and the naming convention of the scripts (e.g.
     they all live in pre-commit.d/ directory, and executed in ASCII byte
     value order of their names);

 (2) how their exit status combine together.  For example, maybe a failure
     from one of the scripts prevents none of the later scripts to even
     run and make the whole hook return a failure; maybe a failure will be
     remembered, but the other scripts may still want to be run to learn
     about the fact that the commit was attempted, and the whole hook
     returns a failure if any of them fail.

     In a hook that is run primarily for its side effects and not for
     validation, it may even be desireble if the whole hook returns a
     failure only when all of them fail, iow, for such a hook the status
     is not ANDed but ORed together.

Once you have such a framework and get help from others to widely try it
in the field, it may prove generic enough to include it as the sample hook
script to be installed everywhere.

  reply	other threads:[~2009-01-04 10:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-21 13:38 What about allowing multiple hooks? Marc Weber
2008-11-21 13:55 ` martin f krafft
2008-11-21 14:56 ` Rogan Dawes
2009-01-03 23:32 ` Alexander Potashev
2009-01-04 10:01   ` Junio C Hamano [this message]
2009-01-21 20:35     ` Anders Waldenborg
2009-01-21 21:10       ` Johannes Schindelin
2009-01-21 21:30         ` Anders Waldenborg
2009-01-21 21:50           ` Johannes Schindelin
2009-01-22  9:57             ` Anders Waldenborg

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7vd4f3z8xu.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=aspotashev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=lists@dawes.za.net \
    --cc=madduck@madduck.net \
    --cc=marco-oweber@gmx.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).