aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-10-27 14:54:20 -0700
committerChris Larson <chris_larson@mentor.com>2010-10-27 15:06:23 -0700
commitddffbe483ece35a02449d56b1a1ea45af08a0f4d (patch)
treecb2084256e1bef09003b51faddb33e4e846d3b98
parent1994dbe6134898c2fca796a84f1866d2e216d495 (diff)
downloadopenembedded-ddffbe483ece35a02449d56b1a1ea45af08a0f4d.tar.gz
openembedded-ddffbe483ece35a02449d56b1a1ea45af08a0f4d.tar.bz2
openembedded-ddffbe483ece35a02449d56b1a1ea45af08a0f4d.zip
gitver: fix non-symbolic HEAD ref
Signed-off-by: Chris Larson <chris_larson@mentor.com>
-rw-r--r--classes/gitver.bbclass19
1 files changed, 9 insertions, 10 deletions
diff --git a/classes/gitver.bbclass b/classes/gitver.bbclass
index de182a09c6..28256c6d4c 100644
--- a/classes/gitver.bbclass
+++ b/classes/gitver.bbclass
@@ -32,17 +32,16 @@ def get_git_pv(path, d, tagadjust=None):
# if the active branch is switched, or if the branch changes.
mark_dependency(d, os.path.join(gitdir, "HEAD"))
- ref = git(["symbolic-ref", "HEAD"])
- 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"))
+ # Force a reparse if anything in the index changes.
+ mark_dependency(d, os.path.join(gitdir, "index"))
+
+ try:
+ ref = oe_run(d, ["git", "symbolic-ref", "-q", "HEAD"], cwd=gitdir).rstrip()
+ except oe.process.CmdError:
+ pass
else:
- # The ref might be hidden in packed-refs. Force a reparse if anything
- # in the working copy changes.
- mark_dependency(d, os.path.join(gitdir, "index"))
+ if ref:
+ mark_dependency(d, os.path.join(gitdir, ref))
# Catch new tags.
tagdir = os.path.join(gitdir, "refs", "tags")