repo: create a tombstone commit when deleting a commit

When a commit is deleted and the repo is configured to use tombstone
commits, create one.  Delete the tombstone file only if the commit is
pulled again.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano committed 2015-11-03 09:53:38 +01:00
1 parent 76c5cc07db
commit 646fe139e6
2 files changed
+46

No files matched your search

+22
View File
@@ -770,6 +770,28 @@ write_object (OstreeRepo *self,
cancellable, error))
goto out;
if (objtype == OSTREE_OBJECT_TYPE_COMMIT)
{
GError *local_error = NULL;
/* If we are writing a commit, be sure there is no tombstone for it.
We may have deleted the commit and now we are trying to pull it again. */
if (!ostree_repo_delete_object (self,
OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT,
actual_checksum,
cancellable,
&local_error))
{
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
g_clear_error (&local_error);
else
{
g_propagate_error (error, local_error);
goto out;
}
}
}
if (OSTREE_OBJECT_TYPE_IS_META (objtype))
{
if (G_UNLIKELY (file_object_length > OSTREE_MAX_METADATA_WARN_SIZE))