Re: [PATCH] fetch-pack should not ask for a ref which is already there
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Sep 29, 2005, 18:26 UTC
- Message-ID
- <Pine.LNX.4.58.0509291120170.3308@g5.osdl.org>
- In-Reply-To
- <Pine.LNX.4.63.0509290149230.19126@wgmdd8.biozentrum.uni-wuerzburg.de>
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