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
Johannes Sixt <j.sixt@viscovery.net>
Date
Nov 8, 2010, 13:29 UTC
Message-ID
<4CD7FB37.4050107@viscovery.net>
In-Reply-To
<1289219520-37435-1-git-send-email-bricollins@gmail.com>
Am 11/8/2010 13:32, schrieb Brian Collins:
Show 13 quoted lines
> Run global hooks in the directory specified by the config variable
> hooks.dir before every attempt at running a local hook. If the
> global hook fails, the local hook will not run. If the global hook is
> absent, the local hook runs normally. This is useful because it means
> you can have scripts that run as hooks for multiple repositories, for
> example coding style enforcement for an entire organization, or
> system-wide commit analytics.
> 
> Signed-off-by: Brian Collins <bricollins@gmail.com>
> ---
> 
> The possibility of adding this feature was previously discussed here:
> http://marc.info/?l=git&m=127808782807807&w=2

I'm not in favor of this change, as a number of alternatives were suggested in the thread you cite (Gmane: http://thread.gmane.org/gmane.comp.version-control.git/150141).

A few hints, just in case you deploy this code:
> +	if ((global_path == NULL || access(global_path, X_OK) > 0) &&
> +			access(local_path, X_OK) > 0)
> +		return 0;
access(2) returns zero on success, negative on failure.
> +	if (global_path != NULL)
> +		ret = run_hook_file(global_path, index_file, argv) ||
> +			run_hook_file(local_path, index_file, argv);

What is the value of ret if the hook in global_path fails? Is it the exit code, or is it 1? What should it be?

-- Hannes
Previous: Brian CollinsNext: Junio C Hamano
Message 2 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.