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

Re: Hook after pull ?

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 11, 2007, 21:26 UTC
Message-ID
<7vk5t63a4l.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070711183341.GA2798@steel.home>
Alex Riesen <raa.lkml@gmail.com> writes:
Show 16 quoted lines
> Claudio Scordino, Wed, Jul 11, 2007 17:29:19 +0200:
>> >>If no, does exist any easy way of creating such hook ?
>> >
>> >What for? What do you want to do?
>> >
>> I just need my script to be called after a pull. My script just sends an 
>> email saying that the repository has been pulled (I already did it for the 
>> push).
>
> Ach, on _remote_ repo. Where it is _pulled_from_.
> There are none. You can catch log output of git-daemon, but...
> Isn't it a bit extreme? A fetch (part of a pull) is *very* common
> operation, sometime you'll get a *real* lot of mail.
>
> P.S. BTW, there is no hooks for pull in local (where it is pulled
> into): it is not needed, you already control everything what happens.

I am not sure I am reading this exchange correctly, but I think Claudio wants to say

	$ git pull repo.or.cz:somebody/project.git/ the-branch 

and have it automatically send e-mail to the somebody (obviously the hook script needs to have a mapping from the repository to whom to notify). As the daemon side cannot tell if the local is only fetching (and possibly discarding the result) or pulling (resulting in a merge), I do not think it is reasonable to do the hooking on the remote side. It has to be done on the local if ever.

As you said, the local side has all the control, so in the strictest sense there is no need for post-* hook, but we do support a few hooks for local operations, such as post-commit.

(Sam Vilain CC'ed as he wanted to have hooks during and after a merge).

I suspect that a post merge hook (that also is called in fast-forward case) would be a good thing to have if people would want to do this kind of thing often. The hook most likely wants to get the ORIG_HEAD and the updated HEAD as parameters, and can act differently based on the nature of the merge (e.g. was it fast-forward, was it a merge between the commits made by the same committer as myself, etc.)

Previous: Alex Riesen
Message 5 of 5 in “Hook after pull ?”
  1. Claudio ScordinoJul 11, 2007
  2. Alex RiesenJul 11, 2007
  3. Claudio ScordinoJul 11, 2007
  4. Alex RiesenJul 11, 2007
  5. Junio C HamanoJul 11, 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.