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

Re: [PATCH 6/6] upload-pack: provide a hook for running pack-objects

From
Jeff King <peff@peff.net>
Date
May 19, 2016, 00:14 UTC
Message-ID
<20160519001433.GB22543@sigill.intra.peff.net>
In-Reply-To
<20160518224537.GF22443@sigill.intra.peff.net>
On Wed, May 18, 2016 at 06:45:37PM -0400, Jeff King wrote:
Show 11 quoted lines
> @@ -93,6 +94,14 @@ static void create_pack_file(void)
>  	int i;
>  	FILE *pipe_fd;
>  
> +	if (!pack_objects_hook)
> +		pack_objects.git_cmd = 1;
> +	else {
> +		argv_array_push(&pack_objects.args, pack_objects_hook);
> +		argv_array_push(&pack_objects.args, "git");
> +		pack_objects.use_shell = 1;
> +	}

I waffled on the "shell" thing here. It's more flexible, and matches other commands we let the user specify (like diff.external). But it also makes it harder to do more hook-like things, like "run this hook if it exists and has the executable bit set".

So should it just be a path to a single command/script?
With the shell thing, you can set it to:
  test -e /path/to/script && /path/to/script ...

if you want, but that's a little more arcane (and incurs an extra shell invocation that we could otherwise skip).

And on the same note, if it _were_ just path-to-script, would we want it to skip the hook if it's missing or not executable? For normal hooks, if that's the case, we know it's because the user doesn't want to use the hook. But here, the user has taken an overt action to tell us about the hook; would it be surprising if we silently skipped it because it wasn't available?

I like that it would "fail open", so a misconfiguration doesn't break a server. But maybe people would find that off-putting.

-Peff
Previous: Jeff KingNext: Ævar Arnfjörð Bjarmason
Message 16 of 23 in “pack-objects hook for upload-pack”
  1. 0/6 pack-objects hook for upload-packJeff King, May 18, 2016
  2. 1/6 git_config_with_options: drop "found" countingJeff King, May 18, 2016
  3. 2/6 git_config_parse_parameter: refactor cleanup codeJeff King, May 18, 2016
  4. 3/6 config: set up config_source for command-line configJeff King, May 18, 2016
  5. 4/6 config: return configset value for current_config_ functionsJeff King, May 18, 2016
  6. Jeff KingMay 19, 2016
  7. Duy NguyenMay 26, 2016
  8. Junio C HamanoMay 26, 2016
  9. Jeff KingMay 26, 2016
  10. Junio C HamanoMay 26, 2016
  11. Jeff KingMay 27, 2016
  12. Junio C HamanoMay 27, 2016
  13. Jeff KingMay 27, 2016
  14. 5/6 config: add a notion of "scope"Jeff King, May 18, 2016
  15. 6/6 upload-pack: provide a hook for running pack-objectsJeff King, May 18, 2016
  16. Jeff KingMay 19, 2016
  17. Ævar Arnfjörð BjarmasonMay 19, 2016
  18. Jeff KingMay 19, 2016
  19. Ævar Arnfjörð BjarmasonMay 19, 2016
  20. Jeff KingMay 26, 2016
  21. Junio C HamanoMay 25, 2016
  22. Jeff KingMay 26, 2016
  23. Junio C HamanoMay 26, 2016

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.