Re: [bug] git checkout lies about number of ahead commits when switching from detached HEAD
- From
Jeff King <peff@peff.net>
- Date
- Mar 20, 2011, 09:01 UTC
- Message-ID
- <20110320090111.GA15641@sigill.intra.peff.net>
- In-Reply-To
- <7vy64avdba.fsf@alter.siamese.dyndns.org>
On Sat, Mar 19, 2011 at 05:35:37PM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> Jeff King <peff@peff.net> writes: > > > but I'm not quite sure if this is the right place. Is it the > > responsibility of the checkout-orphan-warning code to clean up after > > itself, or is it the responsibility of a revision walker to clean up > > before itself? > > Usually it is the former; the latter is generally impossible (unless it is > willing to clear everything), but the former knows where it started > traversal from.
For the case of 2 traversals, I suspect that clearing everything between is not so different from clearing from the tips, since most everything parsed was probably from the first traversal. But as we lib-ify more, we may end up with more and more traversals in a single program, so it's probably better to go the more efficient route from the beginning.
So how about this?
[1/3]: checkout: add basic tests for detached-orphan warning [2/3]: checkout: clear commit marks after detached-orphan check [3/3]: checkout: tweak detached-orphan warning format
3/3 is only somewhat related, but I had been meaning to do it anyway. We can break it off into a separate topic if there's a lot of discussion around the 2nd patch.
-Peff