git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Adding custom hooks to a bare repository.
@ 2008-07-28 11:04 Thomas Adam
  2008-07-28 11:26 ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Adam @ 2008-07-28 11:04 UTC (permalink / raw)
  To: git mailing list

Hello all,

I'm trying to add in "post-merge" as a valid hook file to an already
created --bare repository.  In adding it to the correct place and
setting the correct permissions on it (the repository is a shared
one), it doesn't seem to be pulled down with the other hook files
already present when doing a "git clone".

Any ideas why?

Indeed, I also, as a test, added this post-merge hook to a repository
and created a --bare repository from that - thinking that perhaps the
hook file had to present at the time of creating a new repository, but
even then it wasn't copied over to the bare repository.

What am I doing wrong?

Thanks in advance,

-- Thomas Adam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding custom hooks to a bare repository.
  2008-07-28 11:04 Adding custom hooks to a bare repository Thomas Adam
@ 2008-07-28 11:26 ` Johannes Schindelin
  2008-07-28 12:32   ` Thomas Adam
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2008-07-28 11:26 UTC (permalink / raw)
  To: Thomas Adam; +Cc: git mailing list

Hi,

On Mon, 28 Jul 2008, Thomas Adam wrote:

> I'm trying to add in "post-merge" as a valid hook file to an already 
> created --bare repository.  In adding it to the correct place and 
> setting the correct permissions on it (the repository is a shared one), 
> it doesn't seem to be pulled down with the other hook files already 
> present when doing a "git clone".
> 
> Any ideas why?

Yes.  Hooks, just as the config and reflogs, are supposed to be local 
things.  Rationale being: it is rude, and also insecure, to install 
something that potentially calls other programs without the user saying 
so.

All you can do is checking in a copy of the hook, and ask your users/check 
in your build system that it is installed.

Hth,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding custom hooks to a bare repository.
  2008-07-28 11:26 ` Johannes Schindelin
@ 2008-07-28 12:32   ` Thomas Adam
  2008-07-28 12:40     ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Adam @ 2008-07-28 12:32 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git mailing list

2008/7/28 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> Yes.  Hooks, just as the config and reflogs, are supposed to be local
> things.  Rationale being: it is rude, and also insecure, to install
> something that potentially calls other programs without the user saying
> so.

Oh absolutely, I agree with that.

> All you can do is checking in a copy of the hook, and ask your users/check
> in your build system that it is installed.

Hmm -- perhaps I am being unintentionally dense, but I am assuming
that when you say "checking in a copy" you mean anywhere other than
.git/hooks/ since that isn't tracked by git.  I have no problem with
the rationale you've just described -- but it would be handy to add
this post-merge hook script into hooks/ (exec bit removed) such that
on a clone, all one would need to do is chmod +x it.   If that's
possible, I'm clearly missing the steps to enable this.

Thanks,

-- Thomas Adam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding custom hooks to a bare repository.
  2008-07-28 12:40     ` Johannes Schindelin
@ 2008-07-28 12:40       ` Thomas Adam
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Adam @ 2008-07-28 12:40 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git mailing list

2008/7/28 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> For all those reasons, it is better to just commit an executable script in
> your <toplevel>/githooks/post-merge and ask your users to copy it to
> .git/hooks/.

Grand.  Thank you very much.  :)

-- Thomas Adam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding custom hooks to a bare repository.
  2008-07-28 12:32   ` Thomas Adam
@ 2008-07-28 12:40     ` Johannes Schindelin
  2008-07-28 12:40       ` Thomas Adam
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2008-07-28 12:40 UTC (permalink / raw)
  To: Thomas Adam; +Cc: git mailing list

Hi,

On Mon, 28 Jul 2008, Thomas Adam wrote:

> 2008/7/28 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> > Yes.  Hooks, just as the config and reflogs, are supposed to be local 
> > things.  Rationale being: it is rude, and also insecure, to install 
> > something that potentially calls other programs without the user 
> > saying so.
> 
> Oh absolutely, I agree with that.
> 
> > All you can do is checking in a copy of the hook, and ask your 
> > users/check in your build system that it is installed.
> 
> Hmm -- perhaps I am being unintentionally dense, but I am assuming
> that when you say "checking in a copy" you mean anywhere other than
> .git/hooks/ since that isn't tracked by git.  I have no problem with
> the rationale you've just described -- but it would be handy to add
> this post-merge hook script into hooks/ (exec bit removed) such that
> on a clone, all one would need to do is chmod +x it.   If that's
> possible, I'm clearly missing the steps to enable this.

No, as you said, anything in .git/ is not meant to be tracked.  Besides, 
if a user would change the executable bit (as advised), Git would always 
show this file as modified, making the tree permanently dirty (or worse, 
it could be accidentally be committed as executable).

For all those reasons, it is better to just commit an executable script in 
your <toplevel>/githooks/post-merge and ask your users to copy it to 
.git/hooks/.

Hth,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-07-28 12:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-28 11:04 Adding custom hooks to a bare repository Thomas Adam
2008-07-28 11:26 ` Johannes Schindelin
2008-07-28 12:32   ` Thomas Adam
2008-07-28 12:40     ` Johannes Schindelin
2008-07-28 12:40       ` Thomas Adam

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).