[PATCH 4/9] fetch2/git: keep the gitpkgv commit count numeric
Anders Heimer <[email protected]> Thu, 25 Jun 2026 09:07:45 +0200
| Newsgroups | org.openembedded.lists.bitbake-devel |
|---|---|
| Message-ID | <[email protected]> |
The cold-cache path used to keep the raw splitlines() list in commits while only using len(commits) when writing the cache file. That same commits value is formatted into the returned version string below, so cold cache could return a Python list representation while warm cache returned the numeric count. Store the numeric count in commits before both writing the cache and building the return value. Signed-off-by: Anders Heimer <[email protected]> --- lib/bb/fetch2/git.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py index 00983b744..0bb2ea39a 100644 --- a/lib/bb/fetch2/git.py +++ b/lib/bb/fetch2/git.py @@ -1031,9 +1031,9 @@ class Git(FetchMethod): commits = None else: if not os.path.exists(rev_file) or not os.path.getsize(rev_file): - commits = bb.fetch2.runfetchcmd(['git', 'rev-list', rev, '--'], d).splitlines() + commits = len(bb.fetch2.runfetchcmd(['git', 'rev-list', rev, '--'], d).splitlines()) if commits: - open(rev_file, "w").write("%d\n" % len(commits)) + open(rev_file, "w").write("%d\n" % commits) else: commits = open(rev_file, "r").readline(128).strip() if commits: