diff options
author | Philip Withnall <withnall@endlessm.com> | 2017-06-09 18:45:39 +0100 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-06-26 15:56:07 +0000 |
commit | 3dd4848c9606f3e8d5e4c974f16be5e910769a5f (patch) | |
tree | 65700f572029ba3c204cc1d5576f28dedc6356a4 /src/ostree/ot-builtin-fsck.c | |
parent | 18456d25fb1071909b83e203c16ad898cd651f7b (diff) | |
download | ostree-3dd4848c9606f3e8d5e4c974f16be5e910769a5f.tar.gz |
ostree/builtins: Add support for collection–refs to a few utilities
These utilities were not needed for the initial port to support
OstreeCollectionRef, so have been delayed a bit and, in some cases, left
as FIXME comments for follow up later.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #924
Approved by: cgwalters
Diffstat (limited to 'src/ostree/ot-builtin-fsck.c')
-rw-r--r-- | src/ostree/ot-builtin-fsck.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ostree/ot-builtin-fsck.c b/src/ostree/ot-builtin-fsck.c index 936bdce4..66f5536d 100644 --- a/src/ostree/ot-builtin-fsck.c +++ b/src/ostree/ot-builtin-fsck.c @@ -241,6 +241,28 @@ ostree_builtin_fsck (int argc, char **argv, GCancellable *cancellable, GError ** return glnx_prefix_error (error, "Loading commit for ref %s", refname); } +#ifdef OSTREE_ENABLE_EXPERIMENTAL_API + if (!opt_quiet) + g_print ("Validating refs in collections...\n"); + + g_autoptr(GHashTable) all_collection_refs = NULL; /* (element-type OstreeCollectionRef utf8) */ + if (!ostree_repo_list_collection_refs (repo, NULL, &all_collection_refs, + cancellable, error)) + return FALSE; + + g_hash_table_iter_init (&hash_iter, all_collection_refs); + while (g_hash_table_iter_next (&hash_iter, &key, &value)) + { + const OstreeCollectionRef *ref = key; + const char *checksum = value; + g_autoptr(GVariant) commit = NULL; + if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, + checksum, &commit, error)) + return glnx_prefix_error (error, "Loading commit for ref (%s, %s)", + ref->collection_id, ref->ref_name); + } +#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */ + if (!opt_quiet) g_print ("Enumerating objects...\n"); |