git-fetch: use fetch--tool pick-rref to avoid local fetch from alternate
commite3c6f240fd9c5bdeb33f2d47adc859f37935e2df
authorJunio C Hamano <junkio@cox.net>
Thu, 5 Apr 2007 10:22:55 +0000 (5 03:22 -0700)
committerJunio C Hamano <junkio@cox.net>
Tue, 10 Apr 2007 19:58:17 +0000 (10 12:58 -0700)
tree348289bd9be1b9adcc7982ca79d309211c4ada27
parent895a1d1e57c8dfb8470bb742f05f1969b9961e07
git-fetch: use fetch--tool pick-rref to avoid local fetch from alternate

When we are fetching from a repository that is on a local
filesystem, first check if we have all the objects that we are
going to fetch available locally, by not just checking the tips
of what we are fetching, but with a full reachability analysis
to our existing refs.  In such a case, we do not have to run
git-fetch-pack which would send many needless objects.  This is
especially true when the other repository is an alternate of the
current repository (e.g. perhaps the repository was created by
running "git clone -l -s" from there).

The useless objects transferred used to be discarded when they
were expanded by git-unpack-objects called from git-fetch-pack,
but recent git-fetch-pack prefers to keep the data it receives
from the other end without exploding them into loose objects,
resulting in a pack full of duplicated data when fetching from
your own alternate.

This also uses fetch--tool pick-rref on dumb transport side to
remove a shell loop to do the same.

Signed-off-by: Junio C Hamano <junkio@cox.net>
git-fetch.sh