Subject: Re: optimising a push by fetching objects from nearby repos

From: Junio C Hamano <[email-masked]>
Date: Sat, 10 May 2014 14:02:16 -0700

Sitaram Chamarty <[email-masked]> writes:

> Is there a trick to optimising a push by telling the receiver to pick up
> missing objects from some other repo on its own server, to cut down even
> more on network traffic?
>
> So, hypothetically,
>
>     git push user@host:repo1 --look-for-objects-in=repo2
>
> I'm aware of the alternates mechanism, but that makes the dependency on
> the other repo sort-of permanent.

In the direction of fetching, this may be give a good starting point.

    http://thread.gmane.org/gmane.comp.version-control.git/243918/focus=245397

In the direction of pushing, theoretically you could:

 - define a new capability "look-for-objects-in" to pass the name of
   the repository from "git push" to the "receive-pack";

 - have "receive-pack" temporarily borrow from the named repository
   (if the policy on the server side allows it), and accept the push;

 - repack in order to dissociate the receiving repository from the
   other repository it temporarily borrowed from.

which would be the natural inverse of the approach suggested in the
"Can I borrow just temporarily while cloning?" thread.

But I haven't thought things through with respect to what else need
to be modified to make sure this does not have adverse interaction
with simultaneous pushes into the same repository, which would make
it harder to solve for "receive-pack" than for "clone/fetch".