All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: pascal@obry.net
Cc: git list <git@vger.kernel.org>
Subject: Re: git svn and the post-receive hook
Date: Sat, 02 Aug 2008 13:16:05 -0700	[thread overview]
Message-ID: <7vod4bdvga.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <4894B387.4040004@obry.net> (Pascal Obry's message of "Sat, 02 Aug 2008 21:20:39 +0200")

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.

  reply	other threads:[~2008-08-02 20:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-02 16:05 git svn and the post-receive hook Pascal Obry
2008-08-02 18:03 ` Miklos Vajna
2008-08-02 18:22 ` Junio C Hamano
2008-08-02 18:43 ` Junio C Hamano
2008-08-02 19:20   ` Pascal Obry
2008-08-02 20:16     ` Junio C Hamano [this message]
2008-08-02 20:45       ` Miklos Vajna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vod4bdvga.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pascal@obry.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.