git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eugene Sajine <euguess@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: global hooks - once again
Date: Fri, 02 Jul 2010 12:18:59 -0700	[thread overview]
Message-ID: <7v630x1yl8.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <AANLkTikXJS5QCXMXgsOfkYn9cMBQV6o23tds5YG3A_OI@mail.gmail.com> (Eugene Sajine's message of "Fri\, 2 Jul 2010 12\:23\:42 -0400")

Eugene Sajine <euguess@gmail.com> writes:

> For example, so i could say
> $ git config --global hooks.dir ~/git/hooks

I don't think "global" hooks are useful for people who work on more than
one project, or people who interact in more than one ways to projects.
Different projects typically have different needs out of the hooks
(e.g. pre-commit policy), and different workflows typically call for
different needs out of the hooks (e.g. I would want to be able to rebase
in my private working repository but not in the repository I use for
integration of other people's branches).

So I am fairly negative on your particular example above.

But it is understandable for one to use more than one repository for the
same project and use them in the same way; in such a case, I agree that a
way to ensure that these repositories use the same set of hooks (and
non-hooks, e.g. commit templates, local ignore pattern files, etc.) is
desirable.

So I would imagine that your example without "--global" would be a
reasonable thing to do once per repository.

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' -"

could also be a simple single-command solution that is "do once per
repository".

Can't we do better and make this "do nunce per repository" instead?

You first have to think how you are creating these more-than-one
repositories you would want to make sure they use the same hooks.  For
example, do you have a single "upstream" repository and everything is a
clone of it?  If so, perhaps a way to tell "clone" via $HOME/.gitconfig
that when cloning from a particular URL you would want to run a particular
post-clone script might be a better way.

  parent reply	other threads:[~2010-07-02 19:19 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 [this message]
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

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=7v630x1yl8.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=euguess@gmail.com \
    --cc=git@vger.kernel.org \
    /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).