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

Re: [PATCH 1/4] push options: {pre,post}-receive hook learns about push options

From
Stefan Beller <sbeller@google.com>
Date
Jul 1, 2016, 17:20 UTC
Message-ID
<CAGZ79kaDCLm3BBURJKfkYWKKvozkFTGCn0wGiQCtspUvtQBd+g@mail.gmail.com>
In-Reply-To
<20160701071410.GG5358@sigill.intra.peff.net>
On Fri, Jul 1, 2016 at 12:14 AM, Jeff King <peff@peff.net> wrote:
Show 6 quoted lines
>
> Putting the data into a file does alleviate some issues. But it also
> makes parsing annoying, and opens up new issues (like what happens
> to content that has a newline in it?). Wouldn't multiple files be a bit
> more convenient? Especially for your example of eventually carrying
> larger binary content like images.

Yeah I did not think about having multiple files. I think that is the way to go now. In the environment variable you'd have the paths, such that

process_hook_option_from_file()
{
 ... # do a thing with $1
}
for p in $GIT_HOOK_OPTION_FILES ;
do
  process_hook_option_from_file $p
done
is a viable hook.
Show 6 quoted lines
>> The rationale for keeping the actual options inside a file instead of
>> putting them directly into an environment variable has multiple reasons:
>
> Thanks for including this rationale; my first thought on seeing the
> patch was "wouldn't this be much more convenient for a hook if each
> value had its own environment variable?".

That's what I thought as well. Office discussion ensued and I am still offended by this solution, but it sucks less than multiple environment variables (I tried writing a script to construct and evaluate the environment variables and that doesn't look nice)

If we did not have a GIT_PUSH_OPTIONS_COUNT and GIT_PUSH_OPTION_<N> but rather GIT_PUSH_OPTIONS_VARIABLES that contains the other variables, it may be easier to handle, but whether you read from a file or evaluate the environment variable is only a minor step, the indirection is there anyway and this would be very close to what we have above.

Thanks, Stefan

>
> -Peff
Previous: Jeff KingNext: Jeff King
Message 8 of 22 in “[RFC PATCHv1 0/4] Push options in C Git”
  1. Stefan BellerJun 30, 2016
  2. 2/4 receive-pack: implement advertising and receiving push optionsStefan Beller, Jun 30, 2016
  3. Junio C HamanoJul 1, 2016
  4. Stefan BellerJul 1, 2016
  5. 4/4 add a test for push optionsStefan Beller, Jun 30, 2016
  6. 1/4 push options: {pre,post}-receive hook learns about push optionsStefan Beller, Jun 30, 2016
  7. Jeff KingJul 1, 2016
  8. Stefan BellerJul 1, 2016
  9. Jeff KingJul 1, 2016
  10. Junio C HamanoJul 1, 2016
  11. Jeff KingJul 1, 2016
  12. Junio C HamanoJul 1, 2016
  13. Stefan BellerJul 1, 2016
  14. Jeff KingJul 1, 2016
  15. Stefan BellerJul 1, 2016
  16. Stefan BellerJul 1, 2016
  17. 3/4 push: accept push optionsStefan Beller, Jun 30, 2016
  18. Jeff KingJul 1, 2016
  19. Stefan BellerJul 1, 2016
  20. Jeff KingJul 1, 2016
  21. Stefan BellerJul 1, 2016
  22. Jeff KingJul 1, 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.