repo/private: allow committing/aborting through a transaction guard

This enhances the auto-transaction logic, augmenting the scope of a
transaction guard.
It allows committing or aborting a transaction through its guard.
It also supports tracking the completion status of a transaction
guard, avoiding double commits/aborts, while retaining the auto-cleanup
logic.
This commit is contained in:
Luca BRUNO committed 2021-10-05 12:23:22 +00:00
1 parent 5bf4b1dabc
commit c987534595
4 files changed
+156 -35

No files matched your search

+2 -2
View File
@@ -445,7 +445,7 @@ generate_deployment_refs (OstreeSysroot *self,
cancellable, error))
return FALSE;
g_autoptr(_OstreeRepoAutoTransaction) txn =
g_autoptr(OstreeRepoAutoTransaction) txn =
_ostree_repo_auto_transaction_start (repo, cancellable, error);
if (!txn)
return FALSE;
@@ -458,7 +458,7 @@ generate_deployment_refs (OstreeSysroot *self,
ostree_repo_transaction_set_refspec (repo, refname, ostree_deployment_get_csum (deployment));
}
if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
if (!_ostree_repo_auto_transaction_commit (txn, NULL, cancellable, error))
return FALSE;
return TRUE;