1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

oeqa/utils/metadata: Add commit_count to fallback logic

Currently if python3-git isn't installed we can get odd behaviours when the
commit_count is absent. Avoid this set of bugs by adding a fallback here.

(From OE-Core rev: b8d22ed681141ce360d742a96cec5f2925a20222)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2019-02-23 15:54:35 +00:00
parent 4a67dfb089
commit 5353c1af71
+4 -2
View File
@@ -72,8 +72,10 @@ def git_rev_info(path):
info['commit'] = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=path).decode('utf-8').strip()
except subprocess.CalledProcessError:
pass
return info
try:
info['commit_count'] = int(subprocess.check_output(["git", "rev-list", "--count", "HEAD"], cwd=path).decode('utf-8').strip())
except subprocess.CalledProcessError:
pass
try:
repo = Repo(path, search_parent_directories=True)
except (InvalidGitRepositoryError, NoSuchPathError):