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

Re: [PATCH 0/4] pre-push hook support

From
Aaron Schrab <aaron@schrab.com>
Date
Dec 29, 2012, 14:50 UTC
Message-ID
<20121229145025.GA3789@pug.qqx.org>
In-Reply-To
<7v1ue9hb06.fsf@alter.siamese.dyndns.org>
At 18:01 -0800 28 Dec 2012, Junio C Hamano <gitster@pobox.com> wrote:
>One lesson we learned long time ago while doing hooks is to avoid
>unbound number of command line arguments and instead feed them from
>the standard input.  I think this should do the same.

Good point. I had been trying to keep the interface for this hook as close as possible to the ones for other client-side hooks on the theory that less development effort may go into those than for server-side hooks. But thinking on that more I certainly see that this could easily run into limits on argument length on some systems; especially when it's likely that each of those arguments is likely to be over 100 bytes long.

I'll work on an updated version which sends the variable length information over a pipe, using the command-line arguments only to pass the remote name and URL.

>How does the hook communicate its decision to the calling Git?
>
>Will it be "all-or-none", or "I'll allow these but not those"?

Currently it just uses the exit code to communicate that back, so it's all-or-none. I think I'll keep that in the updated version as well.

A future enhancement could modify the protocol to support reading from the hook's stdout the names of remote refs which are to be rejected, I think that just having the option for all-or-nothing is a good starting point.

Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 22 in “pre-push hook support”
  1. 0/4 pre-push hook supportAaron Schrab, Dec 28, 2012
  2. 1/4 hooks: Add function to check if a hook existsAaron Schrab, Dec 28, 2012
  3. Junio C HamanoDec 29, 2012
  4. Aaron SchrabDec 29, 2012
  5. Junio C HamanoDec 29, 2012
  6. 2/4 hooks: support variable number of parametersAaron Schrab, Dec 28, 2012
  7. 3/4 push: Add support for pre-push hooksAaron Schrab, Dec 28, 2012
  8. 4/4 Add sample pre-push hook scriptAaron Schrab, Dec 28, 2012
  9. Junio C HamanoDec 29, 2012
  10. Aaron SchrabDec 29, 2012
  11. Junio C HamanoDec 29, 2012
  12. 0/3 pre-push hook supportAaron Schrab, Jan 13, 2013
  13. 1/3 hooks: Add function to check if a hook existsAaron Schrab, Jan 13, 2013
  14. 2/3 push: Add support for pre-push hooksAaron Schrab, Jan 13, 2013
  15. Junio C HamanoJan 14, 2013
  16. Junio C HamanoJan 15, 2013
  17. Junio C HamanoJan 15, 2013
  18. 3/3 Add sample pre-push hook scriptAaron Schrab, Jan 13, 2013
  19. Junio C HamanoJan 14, 2013
  20. Junio C HamanoJan 14, 2013
  21. Junio C HamanoJan 14, 2013
  22. Junio C HamanoJan 15, 2013

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.