Re: [PATCH v2 3/6] clone: factor out checkout code
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Jan 10, 2012, 05:57 UTC
- Message-ID
- <CACsJy8DG2CCbDipfFEp2JM5wb0Nn9F7v8Cxx1bPAZ-40OdEA9A@mail.gmail.com>
- In-Reply-To
- <7vhb04b1bc.fsf@alter.siamese.dyndns.org>
On Tue, Jan 10, 2012 at 11:59 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
>> 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. > > I like that reasoning in general. The logic ought to be: > > - Learn what the remote has; > > - Combine it with --branch parameter, determine what local branch our > head _should_ point at; > > - Make our head point at it, and check it out. > > I wonder if we can somehow make the above logic more clear in the > code. Perhaps the first two could be made into a single helper function > "decide_local_branch()", and the third would be the "checkout()" function > in your patch, updated to take "const char *" parameter or something?
yeah, I split the first two into update_head() but dropped it for some reasons I don't remember. That would make the main function easier to follow. I'll look at it again.
-- Duy