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

Re: git svn and the post-receive hook

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 2, 2008, 20:16 UTC
Message-ID
<7vod4bdvga.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<4894B387.4040004@obry.net>
Pascal Obry <pascal@obry.net> writes:
> BTW, I do not see why this would be a problem with git-svn whereas the
> post-receive hook is fine for Git.

You probably haven't read Miklos's response have you? post-receive is about what happens at the remote end after you "push" there, and does not have to do with what happens when you fetch.

The article I gave you a link earlier gives a guideline to decide when we choose to add hook for particular step of operation (and when we choose not to). The new call from "git svn rebase" (and presumably "git svn fetch" which is the first step of that operation) needs to be justified.

Having said that, I would have framed your argument in a different way. I suspect then you would not have heard the above objections if you did so:

   After pushing to a remote side, there is a post-receive hook so that
   some processing can happen depending on which refs changed from what
   commit to what new commit.  This is primarily because "push" goes to
   the remote side and the user may not have any other means to trigger an
   operation over there (e.g. there may not be ssh login access, just
   git-shell running to accept pushes).
   After fetching from somewhere else, there is no post-fetch hook.  This
   is not a show-stopper problem because the operation is local.  You can
   remember where the refs were before running a fetch, run the fetch, and
   run necessary post-fetch operation.  IOW, instead of "git fetch" (or
   "git svn fetch") calling a custom script installed as a hook, a custom
   script can call "git fetch" (or "git svn fetch") as part of what it
   does.
   However, fetch and push are logically the same operation --- update a
   set of refs on one end to match the other end, while transferring the
   necessary objects to keep the updated refs valid.  We even suggest
   (with satellite-mothership configuration) to push into remote when
   network reachability constraints keeps you from fetching in the other
   direction or vice versa.  If you used fetch to update refs at the
   receiving end only because you somehow cannot push in the other
   direction, it is natural you would want to do the same processing after
   the fetch that post-receive hook would have done if you could push in
   the direction you originally wanted to.
   Which suggests that we may be better off having a unified post-sync
   hook, that would be called with the same arguments as existing
   post-receive hook is called with, whenever fetch initiated at the local
   end or a push initiated from elsewhere updates refs in the local
   repository (such a hook is justified because it needs to _also_ work
   at the remote side).
   To keep the migration hassle to the minimum, we can reuse post-receive
   hook itself for that purpose without actually introducing a new
   post-sync hook.  So how about calling post-receive from "git fetch" and
   "git svn fetch"?  This is a change in semantics, and it may break
   people's existing setups (i.e. they may be relying on post-receive not
   to trigger when they fetch), so we need to proceed carefully, but I
   think it is in the right direction.

I actually am more than sympathetic to this cause. I think the unified post-sync mechanism is a sensible thing to do, at least in the longer term.

We might also need to teach push over http (which is not even a second class citizen) to trigger post-receive if it does not already do so.

Previous: Pascal ObryNext: Miklos Vajna
Message 6 of 7 in “git svn and the post-receive hook”
  1. Pascal ObryAug 2, 2008
  2. Miklos VajnaAug 2, 2008
  3. Junio C HamanoAug 2, 2008
  4. Junio C HamanoAug 2, 2008
  5. Pascal ObryAug 2, 2008
  6. Junio C HamanoAug 2, 2008
  7. Miklos VajnaAug 2, 2008

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.