git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eugene Sajine <euguess@gmail.com>, git@vger.kernel.org
Subject: Re: global hooks - once again
Date: Fri, 2 Jul 2010 15:53:49 -0500	[thread overview]
Message-ID: <20100702205348.GA8134@burratino> (raw)
In-Reply-To: <7v630x1yl8.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:

> Now, as long as the "do once per repository" action that you need to do is
> simple enough, it doesn't necessarily have to be "git config".  Perhaps
> 
>     [alias]
>     set-hooks = !"sh -c 'rm -fr .git/hooks && ln -s $1 .git/hooks' -"

It is not difficult to set up hook scripts when initializing a
repository.  In fact git clone --template= and the “[init]
templatedir” configuration work pretty well.  What is more difficult
is to change the list of hook scripts later.

If I symlink the entire hooks dir like you describe, I cannot override
a couple of hooks per-repository without teaching the hook scripts to
handle that themselves.  (something like:

	hook=$(basename "$0")
	! test -e "$GIT_DIR/local-hooks/$hook.disable" || exit 0
	! test -e "$GIT_DIR/local-hooks/$hook" ||
		exec "$GIT_DIR/local-hooks/$hook"

)  Maybe that is the simplest solution.

      parent reply	other threads:[~2010-07-02 20:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-02 16:23 global hooks - once again Eugene Sajine
2010-07-02 18:03 ` Jonathan Nieder
2010-07-02 19:30   ` Eugene Sajine
2010-07-02 19:18 ` Junio C Hamano
2010-07-02 19:47   ` Eugene Sajine
2010-07-05 10:03     ` Peter Kjellerstedt
2010-07-06 12:14       ` Alex Riesen
2010-07-06 12:23         ` Eugene Sajine
2010-07-06 14:55           ` Peter Kjellerstedt
2010-07-06 15:00             ` demerphq
2010-07-06 15:32               ` Eugene Sajine
2010-07-06 12:20       ` Eugene Sajine
2010-07-06 14:34     ` demerphq
2010-07-02 20:53   ` Jonathan Nieder [this message]

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=20100702205348.GA8134@burratino \
    --to=jrnieder@gmail.com \
    --cc=euguess@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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).