[poky] fetch2/git: questions on read-tree and checkout-index

Darren Hart dvhart at linux.intel.com
Fri May 20 16:40:18 PDT 2011


Hi Ke,

As I ran into http://bugzilla.yoctoproject.org/show_bug.cgi?id=1089 today
working with Saul to validate bug 1029, I spent some time reading through the
fetch2/git source and the commit history. I had a couple questions regarding the
rationale for the use of "read-tree" and "checkout-index" in the unpack routine:

runfetchcmd("git clone -s -n %s %s" % (ud.clonedir, destdir), d)
if not ud.nocheckout:
    os.chdir(destdir)
    runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d)
    runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d)

As I understand it this would be equivalent to checking out HEAD and then
overwriting everything in the tree with the contents of the repository at
ud.revisions[ud.names[0]]. This results in all the modifications listed with git
status but doesn't add any of the changes back to the index, so the log still
appears to be at HEAD (with a lot of local changes). This seems unnecessary for
the majority of use cases. The one where it seems potentially useful would be
the subdir case. Is that the only motivator for using this method?

If so, what is the motivation for checkout out of a subdir - as opposed to just
changing the recipe to build within that subdir?

>From what I could tell we were not using the ability to merge multiple trees
with the read-tree, which I could see as being useful to generate a tree like
the linux-yocto tree with the meta branch included in the bsp source - but even
that could be done using standard merge commands.

Unless I'm missing a use-case (quite likely as there are next to no comments
articulating the rationale and approach taken) I think it would make more sense
to just checkout the required hash into a detached head for the build and update
any recipes that make use of the subdir option to build within than subdir.
Alternatively, doing a checkout for the non subdir case would make most of the
recipes get this behavior while allowing the subdir users to remain untouched.

Thanks,

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel



More information about the poky mailing list