INNER CODE UNIT · Python
json
pineforge-4pass/pineforge-engine · benchmarks/check_provenance.py:105
def json(self, path: str):
return json.loads(self.bytes(path))
def files(self, directory: str) -> list[str]:
res = (self._git("ls-tree", "-r", "--name-only", self.rev, directory) if self.rev
else self._git("ls-files", directory))
return res.stdout.split()
def pinned(self, commit: str, path: str) -> str:
self.reads.append(f"{commit}:{path}")
res = self._git("show", f"{commit}:{path}")
if res.returncode:
raise Unsourced(f"pinned {commit}:{path} is not in this clone")
return res.stdout
def is_commit(self, sha: str) -> bool:
return self._git("cat-file", "-e", f"{sha}^{{commit}}").returncode == 0