On Thu, 29 Sep 2005, Johannes Schindelin wrote:
With this patch, instead of blindly asking for every remote ref, fetch-pack
first looks in the local repository if that ref is already there.
No. This is WRONG.
It may seem like a sane thing to do, but it is very very horribly broken.
The fact is, if an earlier fetch was interrupted, or if you've used things
like rsync, you may have disconnected objects in your object store. The
fact that you have a particular commit object is _not_ a guarantee that
you have everything that leads up to it.
The "fetch" semantics are simple: we only write out new refs _after_ we've
fetched all the objects that point to them. That means that while we
cannot trust a "oh, I already have this commit, let's skip it", we _can_
trust "oh, I already have these refs, let's skip them".
So please do _not_ add logic like this to git-fetch. I'd _much_ rather
fetch some objects twice than end up with a corrupt repository.
Linus