CI: Silence expected error message for shallow repo

This commit is contained in:
Chris Hennes
2025-10-30 08:58:39 -05:00
committed by Adrián Insaurralde Avalos
parent 22309af65c
commit 0bc707ad34

View File

@@ -305,7 +305,8 @@ class GitControl(VersionControl):
referencerevision = 14555
result = None
countallfh = os.popen("git rev-list --count %s..HEAD" % referencecommit)
null_device = "nul" if os.name == "nt" else "/dev/null"
countallfh = os.popen(f"git rev-list --count {referencecommit}..HEAD 2>{null_device}")
countallstr = countallfh.read().strip()
if countallfh.close() is not None: # reference commit not present, use the date
date_object = datetime.datetime.strptime(self.date, "%Y/%m/%d %H:%M:%S")