From ddffbe483ece35a02449d56b1a1ea45af08a0f4d Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Wed, 27 Oct 2010 14:54:20 -0700 Subject: gitver: fix non-symbolic HEAD ref Signed-off-by: Chris Larson --- classes/gitver.bbclass | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'classes') 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") -- cgit 1.2.3-korg