git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: cloning/pulling hooks

From
Petr Baudis <pasky@suse.cz>
Date
Aug 29, 2007, 09:52 UTC
Message-ID
<20070829095202.GE1219@pasky.or.cz>
In-Reply-To
<200708291005.08795.andyparkins@gmail.com>
On Wed, Aug 29, 2007 at 11:05:07AM CEST, Andy Parkins wrote:
Show 25 quoted lines
> On Tuesday 2007 August 28, Petr Baudis wrote:
> 
> > On Tue, Aug 28, 2007 at 06:46:48PM CEST, Josh England wrote:
> > > When cloning an existing repository, is there any way to grab
> > > the .git/hooks files as part of the clone (or pull)?
> >
> >   No. You can add the appropriate instructions to instructions how to
> > clone the repository, users have to install the hooks manually.
> >
> >   Now I went on with a large writeup on considerations for implementing
> > such a feature (including security), but then I scrapped it. What would
> > you like to use these hooks for? Really, perhaps it's best to instead do
> > any "post-commit" etc. checks at the push time instead of the commit
> > time, so that developers can still freely commit locally, e.g. I
> > sometimes do temporary commits on side branches of various work in
> > progress changes, then randomly merge them together etc. before I come
> > up with the final sequence of commits that I push out.
> 
> I've not done it for myself yet, but I had an idea about making an independent 
> branch in the repository itself containing the hook scripts for that project.  
> That way, the cloners get the scripts but still have to knowingly install 
> them themselves.
> 
> If you were feeling particularly brave, you could check that branch out 
> in .git/hooks.

Yes, that was one of my ideas as well; but one thing is that you may want different hooks scripts for different branches or even different times in a particular branch. So maybe .git-hooks/, with each change printing a bit fat warning and setting -x. On the other hand maybe it might be simpler to do the tests for which branch/commit are you working on in the hooks themselves.

But overally, I'm still not convinced that there is a feasible use-case for the cloned hooks at all. Someone has a particular example?

-- 
				Petr "Pasky" Baudis
Early to rise and early to bed makes a male healthy and wealthy and dead.
                -- James Thurber
Previous: Andy ParkinsNext: Andy Parkins
Message 2 of 17 in “Re: cloning/pulling hooks”
  1. Andy ParkinsAug 29, 2007
  2. Petr BaudisAug 29, 2007
  3. Andy ParkinsAug 29, 2007
  4. Johannes SchindelinAug 29, 2007
  5. Andy ParkinsAug 29, 2007
  6. Alex RiesenAug 29, 2007
  7. Benjamin CollinsAug 29, 2007
  8. Petr BaudisAug 29, 2007
  9. Johannes SchindelinAug 29, 2007
  10. Petr BaudisAug 29, 2007
  11. Johannes SchindelinAug 29, 2007
  12. Petr BaudisAug 29, 2007
  13. Johannes SchindelinAug 29, 2007
  14. Petr BaudisAug 29, 2007
  15. Johannes SchindelinAug 29, 2007
  16. Alex RiesenAug 29, 2007
  17. Junio C HamanoAug 29, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.