[ostree] repo: When adding detached metadata, ensure the objdir exists
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: When adding detached metadata, ensure the objdir exists
- Date: Thu, 26 Sep 2013 18:37:48 +0000 (UTC)
commit 10cf4ccabcd4eb35812a2f781d9eb2aba2506030
Author: Colin Walters <walters verbum org>
Date: Thu Sep 26 13:59:08 2013 -0400
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.
src/libostree/ostree-repo-commit.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c
index a2bd263..fe44956 100644
--- a/src/libostree/ostree-repo-commit.c
+++ b/src/libostree/ostree-repo-commit.c
@@ -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),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]