gitver.bbclass: fix issue with detached heads
authorCliff Brake <cbrake@bec-systems.com>
Tue, 15 Jun 2010 20:23:28 +0000 (16:23 -0400)
committerCliff Brake <cbrake@bec-systems.com>
Tue, 15 Jun 2010 20:23:28 +0000 (16:23 -0400)
classes/gitver.bbclass

index 5b4ba8d..445067e 100644 (file)
@@ -38,9 +38,12 @@ def get_git_pv(path, d, tagadjust=None):
     mark_dependency(d, os.path.join(gitdir, "HEAD"))
 
     ref = popen(["git", "symbolic-ref", "HEAD"])
-    reffile = os.path.join(gitdir, ref)
-    if ref and os.path.exists(reffile):
-        mark_dependency(d, reffile)
+    if ref:
+        reffile = os.path.join(gitdir, ref)
+        if os.path.exists(reffile):
+            mark_dependency(d, reffile)
+        else:
+            mark_dependency(d, os.path.join(gitdir, "index"))
     else:
         # The ref might be hidden in packed-refs. Force a reparse if anything
         # in the working copy changes.