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

Re: Documentation of post-receive hook

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 17, 2017, 01:41 UTC
Message-ID
<xmqqpo8hu1fi.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1510872031.23230.7.camel@gmail.com>
Christoph Michelbach <michelbach94@gmail.com> writes:
> I think the documentation of the post-receive hook is misleading. When reading
> it, it appears as though the post-receive hook is executed even when no commits
> are transferred by a git push because it isn't mentioned anywhere that this is
> necessary for its execution.

In other words, post-receive hook triggers only after it receives objects. A mere action of running receive-pack command does not.

> This can easily be fixed by changing
>
>     This hook is invoked by 'git-receive-pack' on the remote repository,
>     which happens when a 'git push' is done on a local repository.

So the existing description is technically correct (i.e. it does correctly identify who invokes it) but lacks a more interesting and relevant information (i.e. receive-pack invokes only after receiving data).

>     This hook is invoked by 'git-receive-pack' on the remote repository,
>     which happens when a 'git push' is done on a local repository and
>     successfully transfers at least 1 commit.

I am not sure "at least 1 commit" is a good phrase to use here. There are transfer that sends objects but no commit object, and the above makes it sound as if such a transfer will not trigger the hook. Would

	This hook is run by 'git receive-pack' on the remote
	repository, after it receives objects sent by 'git push'.

be clear enough to teach readers that a no-op push that recieve-pack does not receive any object does not trigger the hook?

Previous: Christoph MichelbachNext: Junio C Hamano
Message 2 of 11 in “Documentation of post-receive hook”
  1. Christoph MichelbachNov 16, 2017
  2. Junio C HamanoNov 17, 2017
  3. Junio C HamanoNov 17, 2017
  4. Christoph MichelbachNov 19, 2017
  5. Robert P. J. DayNov 19, 2017
  6. Christoph MichelbachNov 19, 2017
  7. Junio C HamanoNov 20, 2017
  8. Christoph MichelbachNov 21, 2017
  9. Junio C HamanoNov 22, 2017
  10. Christoph MichelbachNov 22, 2017
  11. Re*: Documentation of post-receive hookJunio C Hamano, Nov 24, 2017

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.