vcs_git: clearer error messages for checkrepo()

This updates error messages the help identify issues when loading srclibs
and fixes pushing srclibs into build vms/containers.
This commit is contained in:
Michael Pöhn 2025-03-31 12:13:57 +02:00 committed by Hans-Christoph Steiner
parent 0d88a94192
commit 046c527ee8

View file

@ -1523,10 +1523,15 @@ class vcs_git(vcs):
it! This is called as a safety check. it! This is called as a safety check.
""" """
p = FDroidPopen(['git', 'rev-parse', '--show-toplevel'], cwd=self.local, output=False) cmd = ['git', 'rev-parse', '--show-toplevel']
p = FDroidPopen(cmd, cwd=self.local, output=False)
result = p.output.rstrip() result = p.output.rstrip()
if p.returncode > 0:
raise VCSException(
f"error: `{' '.join(cmd)}` failed, (in '{os.path.abspath(self.local)}') {result}"
)
if Path(result) != Path(self.local).resolve(): if Path(result) != Path(self.local).resolve():
raise VCSException('Repository mismatch') raise VCSException(f"Repository mismatch ('{self.local}' != '{result}')")
def gotorevisionx(self, rev): def gotorevisionx(self, rev):
if not os.path.exists(self.local): if not os.path.exists(self.local):