From: "Ping Yin" <pkufranky@gmail.com>
To: "Johan Herland" <johan@herland.net>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
"Victor Bogado da Silva Lins" <victor@bogado.net>
Subject: Re: global hooks
Date: Thu, 20 Mar 2008 20:26:32 +0800 [thread overview]
Message-ID: <46dff0320803200526x7b2a535fu25bae005348bb8e6@mail.gmail.com> (raw)
In-Reply-To: <200803201220.47503.johan@herland.net>
On Thu, Mar 20, 2008 at 7:20 PM, Johan Herland <johan@herland.net> wrote:
> On Thursday 20 March 2008, Junio C Hamano wrote:
> > Victor Bogado da Silva Lins <victor@bogado.net> writes:
> >
> > > SO my question is, is there a way to make that hook global to all
> > > projects? If not, would it be a good idea to allow this?
> >
> > Probably a post- git-init hook that lets you do anything to your newly
> > created repository would be the only thing that you need. Then you can
> > copy, untar or even use symlink to muck with .git/hooks/ in whatever way
> > you please.
> >
> > There needs a mechanism for you to specify what that hook is, and it
> > cannot be in individual repositories, so it has to live in ~/.gitconfig
> > somewhere.
>
> Or you could add the hook (either the post-init hook, or for that matter
> the hook you want to make global) to the Git template directory on your
> system (/usr/share/git-core/templates by default). If you don't want to
> make it system-global (only user-global), I guess you could make your
> own Git template directory somewhere (copy the system's template dir,
> and add/enable whatever hooks you like), and set up an alias to
> "git init --template=<your_template_dir>". Then use this alias instead
> of "git init".
>
template dir is meaningful for static hooks. However, sometimes we
need dynamic hooks which change over time. Having a real global hook
can help to implement a single logic or policy spreading among
multiple repositories.
For example, we can enfore a policy to help to update the test or
deploy environent automatically: when repositories are pushed into a
central place, they are checked out into different places or hosts
automatically.
I think ~/.gitconfig is a good place to give such an entry point.
--
Ping Yin
next prev parent reply other threads:[~2008-03-20 12:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-19 16:04 global hooks Victor Bogado da Silva Lins
2008-03-20 1:04 ` Jonathan del Strother
2008-03-20 2:25 ` Junio C Hamano
2008-03-20 11:20 ` Johan Herland
2008-03-20 12:26 ` Ping Yin [this message]
2008-03-20 12:56 ` Johan Herland
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46dff0320803200526x7b2a535fu25bae005348bb8e6@mail.gmail.com \
--to=pkufranky@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johan@herland.net \
--cc=victor@bogado.net \
/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.
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 NNTP newsgroup(s).