mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-19 22:50:35 +03:00
repo: When adding detached metadata, ensure the objdir exists
We may be creating the commitmeta file before the commit, so we need to call mkdir(<first two checksum characters>) here too.
This commit is contained in:
parent
edcfcd21a3
commit
10cf4ccabc
@ -1256,8 +1256,10 @@ GFile *
|
||||
_ostree_repo_get_commit_metadata_loose_path (OstreeRepo *self,
|
||||
const char *checksum)
|
||||
{
|
||||
gs_free char *commit_path = ostree_get_relative_object_path (checksum, OSTREE_OBJECT_TYPE_COMMIT, FALSE);
|
||||
return ot_gfile_resolve_path_printf (self->repodir, "%smeta", commit_path);
|
||||
char buf[_OSTREE_LOOSE_PATH_MAX];
|
||||
_ostree_loose_path_with_suffix (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT, self->mode,
|
||||
"meta");
|
||||
return g_file_resolve_relative_path (self->objects_dir, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1328,6 +1330,10 @@ ostree_repo_write_commit_detached_metadata (OstreeRepo *self,
|
||||
gs_unref_object GFile *metadata_path =
|
||||
_ostree_repo_get_commit_metadata_loose_path (self, checksum);
|
||||
|
||||
if (!_ostree_repo_ensure_loose_objdir_at (self->objects_dir_fd, checksum,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!g_file_replace_contents (metadata_path,
|
||||
g_variant_get_data (metadata),
|
||||
g_variant_get_size (metadata),
|
||||
|
Loading…
x
Reference in New Issue
Block a user