Skip to content

Commit 88f808f

Browse files
authored
Merge pull request #115 from jlebon/pr/handle-partial-commits
coreos-ostree-importer: handle partial commits
2 parents cf005a3 + b9aee5b commit 88f808f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

coreos-ostree-importer/coreos_ostree_importer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,12 @@ def ostree_repo_exists(repo: str) -> bool:
321321

322322
def ostree_commit_exists(repo: str, commit: str) -> bool:
323323
cmd = ["ostree", f"--repo={repo}", "show", commit]
324-
return runcmd(cmd, check=False).returncode == 0
324+
if runcmd(cmd, check=False).returncode != 0:
325+
return False
326+
# the commit object exists, but it may be partial
327+
if os.path.exists(os.path.join(repo, 'state', f'{commit}.commitpartial')):
328+
return False
329+
return True
325330

326331

327332
def ostree_branch_exists(repo: str, branch: str) -> bool:

0 commit comments

Comments
 (0)