repo: Don't require a txn for writing
The current "transaction" symlink was introduced to fix issues with interrupted pulls; normally we assume that if we have a metadata object, we also have all objects to which it refers. There used to be a "summary" which had all the available refs, but I deleted it because it wasn't really used, and was still racy despite the transaction bits. We still want the pull process to use the transaction link, so don't delete the APIs, just relax the restriction on object writing, and introduce a new ostree_repo_set_ref_immediate().
This commit is contained in:
1 parent
a4d01976bb
commit
f1ccaa581e
5 files changed
+65
-23
No files matched your search
@@ -570,21 +570,17 @@ ostree_repo_list_refs (OstreeRepo *self,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
write_refspec (OstreeRepo *self,
|
||||
const char *refspec,
|
||||
const char *rev,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
gboolean
|
||||
_ostree_repo_write_ref (OstreeRepo *self,
|
||||
const char *remote,
|
||||
const char *ref,
|
||||
const char *rev,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gs_free char *remote = NULL;
|
||||
gs_free char *name = NULL;
|
||||
gs_unref_object GFile *dir = NULL;
|
||||
|
||||
if (!ostree_parse_refspec (refspec, &remote, &name, error))
|
||||
goto out;
|
||||
|
||||
if (remote == NULL)
|
||||
dir = g_object_ref (self->local_heads_dir);
|
||||
else
|
||||
@@ -600,7 +596,7 @@ write_refspec (OstreeRepo *self,
|
||||
|
||||
if (rev == NULL)
|
||||
{
|
||||
gs_unref_object GFile *child = g_file_resolve_relative_path (dir, name);
|
||||
gs_unref_object GFile *child = g_file_resolve_relative_path (dir, ref);
|
||||
|
||||
if (g_file_query_exists (child, cancellable))
|
||||
{
|
||||
@@ -610,7 +606,7 @@ write_refspec (OstreeRepo *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!write_checksum_file (dir, name, rev, cancellable, error))
|
||||
if (!write_checksum_file (dir, ref, rev, cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -634,8 +630,14 @@ _ostree_repo_update_refs (OstreeRepo *self,
|
||||
{
|
||||
const char *refspec = key;
|
||||
const char *rev = value;
|
||||
gs_free char *remote = NULL;
|
||||
gs_free char *ref = NULL;
|
||||
|
||||
if (!write_refspec (self, refspec, rev, cancellable, error))
|
||||
if (!ostree_parse_refspec (refspec, &remote, &ref, error))
|
||||
goto out;
|
||||
|
||||
if (!_ostree_repo_write_ref (self, remote, ref, rev,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user