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

Re: [PATCH v2] Run global hooks from the directory at hooks.dir

From
Brian Collins <bricollins@gmail.com>
Date
Nov 9, 2010, 03:22 UTC
Message-ID
<AANLkTimx5V7P4yFY0HYP6TNOKa+9fZ1vQUkhoMVL7OeR@mail.gmail.com>
In-Reply-To
<7v39rbpn1c.fsf@alter.siamese.dyndns.org>
> It is left unspecified what happens when the global hook exists and it
> succeeds.  Watch out for hooks that read from their standard input.
The local hook will execute. They are chained.
Show 5 quoted lines
> In any case, the above is totally backwards from the usual practice and
> expectation of local things overriding the global default.  If you want a
> site-wide policy suggestion, default templates would be a more acceptable
> way (and the implementation of hooks you install to developer repositories
> can choose to look at $GIT_DIR/hooks/local-foo-hook).

The global hook doesn't override the local hook, it supplements it. In any case, a developer can set hooks.dir to be something else in a specific repository, and it will override the global default.

Show 5 quoted lines
> By the way, with a distributed scm, anything-wide policy enforcement at
> the level of developer's individual working repositories is a lost cause.
> You are giving freedom to do anything on their own copy of the history to
> the developers; the project-wide policy is to be enforced at the perimeter
> of your authoritative repository of the project.

The developer is in total control, it is a user configuration option. It is the same as setting colours for diffs. Just a preference that makes the developer's life easier by adding some way of automating certain tasks. Say you want to post to IRC every time you commit, this could do that. Or if you want to set up a shell script to jump to your most recently used repository. There are lots of possible applications. I admit "site-wide coding style enforcement" was a bad example, and I certainly don't plan to use it for that.

Previous: Junio C HamanoNext: Brian Collins
Message 4 of 6 in “Run global hooks from the directory at hooks.dir”
  1. Run global hooks from the directory at hooks.dirBrian Collins, Nov 8, 2010
  2. Johannes SixtNov 8, 2010
  3. Junio C HamanoNov 8, 2010
  4. Brian CollinsNov 9, 2010
  5. Brian CollinsNov 8, 2010
  6. Jonathan NiederNov 8, 2010

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.