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

Re: [PATCH v4] Allow update hooks to update refs on their own.

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 2, 2007, 21:56 UTC
Message-ID
<7vwsrwu5fs.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20071202212224.GA22117@midwinter.com>
Steven Grimm <koreth@midwinter.com> writes:
Show 6 quoted lines
> +The hook may optionally choose to update the ref on its own, e.g.,
> +if it needs to modify incoming revisions in some way. If it updates
> +the ref, it should exit with a status of 100.  The hook should exit
> +with a status between 1 and 99 if it wants to disallow updating the
> +named ref.  Otherwise it should exit with zero, and the ref will be
> +updated automatically.

This makes one wonder what happens if it returns 101, iow if there is difference between returning 99 and 101, and if so why.

Show 8 quoted lines
> +Remote Tracking Refs
> +--------------------
> +
> +After successfully sending a pack to the remote, 'git-send-pack'
> +updates the corresponding remote tracking ref in the local repository
> +to point to the same commit as was just sent to the remote side. In
> +most cases this eliminates the need to subsequently fetch from the
> +remote repository since there would be nothing new to fetch.

Micronit. The above is all "if exists". Not everybody pushes to somewhere he uses tracking with.

Show 10 quoted lines
> @@ -70,8 +73,11 @@ static struct command *commands;
>  static const char pre_receive_hook[] = "hooks/pre-receive";
>  static const char post_receive_hook[] = "hooks/post-receive";
>  
> -static int hook_status(int code, const char *hook_name)
> +static int hook_status(int code, const char *hook_name, int ok_start)
>  {
> +	if (ok_start && -code >= ok_start)
> +		return -code;
> +

I've always been puzzled by this "ok_start" parameter from the very beginning edition of your patch. It is not like "if this is true, then it is ok to run the hook but otherwise do not run". In layman's terms, what does the parameter mean?

Maybe the variable is misnamed and not expressing the concept well enough. Maybe the concept itself is muddy and hard to understand. I cannot tell.

Previous: Steven GrimmNext: Jeff King
Message 22 of 44 in “Allow update hooks to update refs on their own”
  1. Allow update hooks to update refs on their ownSteven Grimm, Nov 27, 2007
  2. Jakub NarebskiNov 27, 2007
  3. Steven GrimmNov 27, 2007
  4. Junio C HamanoNov 28, 2007
  5. Steven GrimmNov 28, 2007
  6. Daniel BarkalowNov 28, 2007
  7. Junio C HamanoNov 28, 2007
  8. Steven GrimmNov 28, 2007
  9. Jeff KingNov 28, 2007
  10. Junio C HamanoNov 28, 2007
  11. Allow update hooks to update refs on their ownSteven Grimm, Nov 28, 2007
  12. Jeff KingNov 28, 2007
  13. Steven GrimmNov 28, 2007
  14. Jeff KingNov 28, 2007
  15. Junio C HamanoNov 28, 2007
  16. Allow update hooks to update refs on their ownSteven Grimm, Nov 28, 2007
  17. Jeff KingNov 28, 2007
  18. Junio C HamanoNov 28, 2007
  19. Steven GrimmNov 29, 2007
  20. Junio C HamanoNov 30, 2007
  21. Allow update hooks to update refs on their own.Steven Grimm, Dec 2, 2007
  22. Junio C HamanoDec 2, 2007
  23. Jeff KingDec 3, 2007
  24. Junio C HamanoDec 3, 2007
  25. Junio C HamanoDec 3, 2007
  26. Steven GrimmDec 5, 2007
  27. Junio C HamanoDec 5, 2007
  28. Junio C HamanoDec 5, 2007
  29. Jeff KingDec 6, 2007
  30. Junio C HamanoDec 6, 2007
  31. Jeff KingDec 6, 2007
  32. Steven GrimmDec 6, 2007
  33. Shawn O. PearceDec 3, 2007
  34. Junio C HamanoDec 3, 2007
  35. Shawn O. PearceDec 4, 2007
  36. Johannes SchindelinDec 3, 2007
  37. Shawn O. PearceDec 4, 2007
  38. Johannes SchindelinDec 4, 2007
  39. Shawn O. PearceDec 4, 2007
  40. Johannes SchindelinDec 4, 2007
  41. Steven GrimmDec 4, 2007
  42. Shawn O. PearceDec 4, 2007
  43. Junio C HamanoNov 28, 2007
  44. Jeff KingNov 28, 2007

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.