Changeset View
Changeset View
Standalone View
Standalone View
swh/vault/cookers/git_bare.py
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | class GitBareCooker(BaseVaultCooker): | ||||
def git_fsck(self) -> None: | def git_fsck(self) -> None: | ||||
proc = subprocess.run( | proc = subprocess.run( | ||||
["git", "-C", self.gitdir, "fsck"], | ["git", "-C", self.gitdir, "fsck"], | ||||
stdout=subprocess.PIPE, | stdout=subprocess.PIPE, | ||||
stderr=subprocess.STDOUT, | stderr=subprocess.STDOUT, | ||||
env={"LANG": "C.utf8"}, | env={"LANG": "C.utf8"}, | ||||
) | ) | ||||
if not self._expected_fsck_errors: | |||||
# All went well, there should not be any error | |||||
proc.check_returncode() | |||||
return | |||||
# Split on newlines not followed by a space | # Split on newlines not followed by a space | ||||
errors = re.split("\n(?! )", proc.stdout.decode()) | errors = re.split("\n(?! )", proc.stdout.decode()) | ||||
unexpected_errors = set(filter(bool, errors)) - self._expected_fsck_errors | errors = [ | ||||
ardumont: is the blank after warning expected? | |||||
Done Inline Actionsyes vlorentz: yes | |||||
error for error in errors if error and not error.startswith("warning ") | |||||
] | |||||
unexpected_errors = set(errors) - self._expected_fsck_errors | |||||
if unexpected_errors: | if unexpected_errors: | ||||
raise Exception( | raise Exception( | ||||
"\n".join( | "\n".join( | ||||
["Unexpected errors from git-fsck:"] + sorted(unexpected_errors) | ["Unexpected errors from git-fsck:"] + sorted(unexpected_errors) | ||||
) | ) | ||||
) | ) | ||||
def write_refs(self, snapshot=None): | def write_refs(self, snapshot=None): | ||||
▲ Show 20 Lines • Show All 307 Lines • Show Last 20 Lines |
is the blank after warning expected?