From: Nguyen Thai Ngoc Duy Date: Tue, 10 Jan 2012 02:01:18 GMT Subject: Re: [PATCH v2 3/6] clone: factor out checkout code Message-ID: In-Reply-To: <7vd3ascs85.fsf@alter.siamese.dyndns.org> 2012/1/10 Junio C Hamano : > Nguyễn Thái Ngọc Duy   writes: > >> Read HEAD from disk instead of relying on local variable >> our_head_points_at, so that if earlier code fails to make HEAD >> properly, it'll be detected. > > The end result might be more or less the same with your patch from the > end-user's point of view, but "if earlier code fails", shouldn't you > detect and diagnose it right there? Sure, but another fence does not harm. There's also one thing I missed in the commit message that it makes update head code and checkout code more independent. Update head code does not need to maintain our_head_points_at at the end for checkout anymore. > If you observe lack of "HEAD" in checkout(), you cannot tell if that was > because the remote did not have anything usable in the first place, or > because we knew where it should point at (and may have even attempted to > create it) but somehow failed to make it point at it. The lack of HEAD probably won't happen because HEAD is created by default in init-db. This is mainly to catch invalid HEAD (like putting "refs/tags/something" in HEAD). -- Duy