]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
fetch2/git: enhance the unpack by using "git checkout"
authorYu Ke <ke.yu@intel.com>
Thu, 26 May 2011 07:37:56 +0000 (15:37 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 27 May 2011 16:19:55 +0000 (17:19 +0100)
current git fetcher unpack method only checkout index and working tree,
but did not did not update the git branch in ref/heads, so user may not
get right info in ${S} by using git.

this patch enhance the unpack by using git checkout to fix this issue.

Fix bug [YOCTO #1089]

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/fetch2/git.py

index 3b8965e49c31a9ee22b67914d0dc6179122e2103..ae44a49b2ab49aedbf713893a84810674f83deb8 100644 (file)
@@ -213,8 +213,11 @@ class Git(FetchMethod):
         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)
+            if subdir != "":
+                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)
+            else:
+                runfetchcmd("%s checkout %s" % (ud.basecmd, ud.revisions[ud.names[0]]), d)
         return True
 
     def clean(self, ud, d):