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

Re: why does builtin/init-db.c mention "/etc/core-git/templates/hooks/update"?

From
Robert P. J. Day <rpjday@crashcourse.ca>
Date
May 28, 2018, 14:09 UTC
Message-ID
<alpine.LFD.2.21.1805281006250.13672@localhost.localdomain>
In-Reply-To
<20180528135902.GA362@sita-lt.atc.tcs.com>
On Mon, 28 May 2018, Sitaram Chamarty wrote:
Show 20 quoted lines
> On Mon, May 28, 2018 at 09:27:18AM -0400, Robert P. J. Day wrote:
>
> [snipped the rest because I really don't know]
>
> >   more to the point, is that actually what the "update" hook does? i
> > just looked at the shipped sample, "update.sample", and it seems to be
> > related to tags:
> >
> >   #!/bin/sh
> >   #
> >   # An example hook script to block unannotated tags from entering.
>
> no that's just a sample.  An update hook can do pretty much
> anything, and if it exits with 0 status code, the actual update
> succeeds.  If it exists with any non-zero exit code, the update will
> fail.
>
> This is (usually) the basis for a lot of checks that people may
> want, from commit message format to access control at the ref
> (branch/tag) level for write operations.
  i'm not convinced that that reference is "just a sample." the
comment in builtin/init-db.c reads:
  /* Note: if ".git/hooks" file exists in the repository being
   * re-initialized, /etc/core-git/templates/hooks/update would
   * cause "git init" to fail here...

the reference to "/etc/core-git/templates/hooks/update" might lead some people to believe that that somehow refers to the "update.sample" hook that comes with a new repo, but that hook is specifically related to git-receive-pack, and has nothing to do with re-initalizing a repo, AFAICT.

  i'm just suggesting that that comment in buildin/init-db.c seems
more than a little inaccurate.
rday
-- 
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
Previous: Sitaram Chamarty
Message 3 of 3 in “why does builtin/init-db.c mention "/etc/core-git/templates/hooks/update"?”
  1. Robert P. J. DayMay 28, 2018
  2. Sitaram ChamartyMay 28, 2018
  3. Robert P. J. DayMay 28, 2018

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.