Re: [PATCH] git-fetch: avoid local fetching from alternate (again)
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Nov 8, 2007, 07:35 UTC
- Message-ID
- <20071108073505.GI14735@spearce.org>
- In-Reply-To
- <7vr6j1bxuf.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Junio C Hamano <gitster@pobox.com> writes: > > > Well spotted. It would be a good idea to commit the big comment > > from contrib/examples/git-fetch.sh to fetch_local_nocopy() > > function, which would have made us realize that the patch does > > not refrain from applying this optimization even when shallow > > is in effect. But I think that is actually a good change. > > I take this back. This regresses badly. > > Why?
Whoops. Good catch. This is why you had a check for the shallow history file in git-fetch.sh before you took this optimization path. My fault for not including it in this patch.
Show 7 quoted lines
> Because the optimization is useless when we are trying to deepen > the shallow history. When you are trying to deepen a shallow > history and the tips of remotes haven't moved since you fetched > from there the last time, you have everything near the tip, and > becuse your history is shallow, your ancestry chain is > cauterized to make it appear that the history is complete. The > rev-list reachability test would not fail as we expect.
What about just inserting a check to see if --depth was supplied to git-fetch on the command line? If so then we are deepening the history and we just bypass the rev-list "fast path" test.
I will be posting an updated patch (series now) shortly.
-- Shawn.