Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Joey Hess <joey@kitenet.net>
Cc: git@vger.kernel.org
Subject: Re: the 100 mb push
Date: Tue, 15 Dec 2009 12:00:41 -0800	[thread overview]
Message-ID: <7vzl5kypli.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20091215192338.GA16654@gnu.kitenet.net> (Joey Hess's message of "Tue\, 15 Dec 2009 14\:23\:38 -0500")

Joey Hess <joey@kitenet.net> writes:

> So, my question is, assuming this is not a straight up bug in git, would
> it make sense to avoid this gotcha in some way?

The "push" support was originally written for people who push into their
own repositories for publishing (i.e. almost always fast-forwarding) and
lacked the elaborate common ancestor discovery negotiation the "fetch"
side had.

Suppose you have a rewound or forked history, like this:


(their side)

                *---Y pu
               / 
          *---X
         /
    *---*---Z master


(your side)

          *---X---*---A pu
         /
    *---*---Z---*---B master

  - You were in sync when the 'pu' was at X with them; somebody pushed a
    few commits on top of it (forked case); or

  - You were in sync when the 'pu' was at Y with them (you pushed it their
    last time yourself), but you rebuilt 'pu' since then (rewound case).

If you run "git push there master +pu", it learns that the tips of
'master' and 'pu' are at Z and Y respectively at their end.  Because the
protocol did not negotiate the common ancestor, it would try to send:

    rev-list A B ^Z ^Y

but using only the information available at your end locally.

Because you either never have heard of (in a forked case) or no longer
know (in a rewound case) what 'Y' is, in order to update 'pu', you end up
sending commits 'Z..A', duplicating 'Z..X' part, because "^Y" cannot
participate in the ancestory computation.  Commits 'Z..B' will be sent to
update 'master'.

And this aspect of "git push" protocol hasn't changed much since it was
written.

In contrast, the protocol used for "fetch" tries to discover 'X' in such a
case by a little exchange, like this:

 downloader: Your tip is at 'Y'?  I've never heard of it.  Please
             tell me about its parents.

 uploader:   It is this "Y^", and its parent is 'X', and ...

 downloader: Ok, I know what 'X' is. I heard enough to proceed. Thank you.

      parent reply	other threads:[~2009-12-15 20:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-15 19:23 the 100 mb push Joey Hess
2009-12-15 19:42 ` Shawn O. Pearce
2009-12-15 20:00 ` Junio C Hamano [this message]

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=7vzl5kypli.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=joey@kitenet.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox