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

Re: [PATCH 1/3] expanded hook api with stdio support

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 3, 2012, 19:53 UTC
Message-ID
<7vsjjwtvf1.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4EFD88CB.3050403@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
> IMO, as the first step, the user of this infrastructure should only be
> required to construct the hook input as a strbuf, and receive the hook
> output, if needed, also as a strbuf.

Now you brought it up, I think I would agree. The only reason I suggested a callback feeder approach was because I somehow was hoping that it may be possible to share more code with the codepath for textconv that may not want to hold too much buffer in core when we know the data is only used sequencially and I wanted to see more things to go through streaming API in the future.

>> +`run_hook_complex`::

Also, I think the updated interface should become the "run_hook" function; nothing "complex" about it. The name "run_hook()" was a perfectly fine abstraction for what it did when it used to be a static helper function within builtin-commit.c, but its special-casing of GIT_INDEX_FILE environment is _not_ general enough to deserve it to be called the "run_hook" in the global scope.

IOW, I am saying that we screwed up at ae98a00 (Move run_hook() from builtin-commit.c into run-command.c (libgit), 2009-01-16.

The environment tweaking should not take a "index_file" field in the structure, but an array "environ" that is used to tweak the environment variables for the hook process.

Previous: Johannes SixtNext: Jeff King
Message 6 of 10 in “extended hook api and tweak-fetch hook”
  1. Joey HessDec 30, 2011
  2. 1/3 expanded hook api with stdio supportJoey Hess, Dec 30, 2011
  3. Johannes SixtDec 30, 2011
  4. Joey HessDec 30, 2011
  5. Johannes SixtDec 30, 2011
  6. Junio C HamanoJan 3, 2012
  7. Jeff KingJan 3, 2012
  8. Junio C HamanoJan 3, 2012
  9. 2/3 preparations for tweak-fetch hookJoey Hess, Dec 30, 2011
  10. 3/3 add tweak-fetch hookJoey Hess, Dec 30, 2011

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.