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

Re: [PATCH] contrib/hooks: avoid requiring root access in usage instructions

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 20, 2012, 07:03 UTC
Message-ID
<20121020070311.GB17969@elie.Belkin>
In-Reply-To
<7vzk3hhj1m.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 7 quoted lines
> We already encourage casting-in-stone a particular version of the
> sample hook when a new repository is created by copying them from
> the template directory.  This prevents from surprising users when an
> updated version of Git changes the behaviour of these samples.  Even
> if you think bugs in older ones may be corrected in newer ones,
> silently updating the hook the user chose to use by inspecting one
> particular version is not something we would want to do lightly.

For context, the sample hooks you are talking about are the *.sample files from the templates/ directory. Except for post-update.sample, most are not very useful out of the box, and they are very much intended as examples to start people's thinking, as opposed to something one-size-fits-all.

By contrast, the post-receive-email script from contrib is a complete program with a well-defined behavior and configuration that have stayed consistent while the details of its implementation improved. It can be used by symlinking into place, but maybe a better set of instructions would say

	# This script takes no arguments and expects the same input format
	# as git's post-receive hook, so if this script is at
	# /usr/share/git-core/contrib/hooks/post-receive-email (as it is
	# on Debian and Fedora), you can do
	#
	#  cd /path/to/your/repository.git
	#  echo '#!/bin/sh' >hooks/post-receive
	#  echo 'exec /usr/share/git-core/contrib/hooks/post-receive-email' \
	#	>>hooks/post-receive
	#  chmod +x hooks/post-receive

That would make it more obvious what I can do next if my post-receive input should be passed both to post-receive-email and some other tool (perhaps in a pipeline using "tee").

Hmm? Jonathan

Previous: Junio C Hamano
Message 3 of 3 in “contrib/hooks: avoid requiring root access in usage instructions”
  1. contrib/hooks: avoid requiring root access in usage instructionsJonathan Nieder, Oct 20, 2012
  2. Junio C HamanoOct 20, 2012
  3. Jonathan NiederOct 20, 2012

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.