diff options
author | Alexander Larsson <alexl@redhat.com> | 2020-10-09 10:55:52 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2020-10-23 13:06:46 +0200 |
commit | 6c8e6539e2487c5d30a18c9b89dd8d6cf4455bb7 (patch) | |
tree | ab57d864bee1f391d8ea5649a38ef93dff9112eb /src/libostree/ostree-repo-static-delta-core.c | |
parent | 0984ff8471cb758f66e8958813670c8ee99e7358 (diff) | |
download | ostree-6c8e6539e2487c5d30a18c9b89dd8d6cf4455bb7.tar.gz |
deltas: Set `indexed-deltas` key in the config and summary
Clients can use these during pull and avoid downloading the summary if
needed, or use the indexed-deltas instead of relying on the ones in
the summary which may be left out.
Diffstat (limited to 'src/libostree/ostree-repo-static-delta-core.c')
-rw-r--r-- | src/libostree/ostree-repo-static-delta-core.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c index 5370d152..c2536724 100644 --- a/src/libostree/ostree-repo-static-delta-core.c +++ b/src/libostree/ostree-repo-static-delta-core.c @@ -1264,6 +1264,7 @@ ostree_repo_static_delta_reindex (OstreeRepo *repo, { g_autoptr(GPtrArray) all_deltas = NULL; g_autoptr(GHashTable) deltas_to_commit_ht = NULL; /* map: to checksum -> ptrarray of from checksums (or NULL) */ + gboolean opt_indexed_deltas; /* Protect against parallel prune operation */ g_autoptr(OstreeRepoAutoLock) lock = @@ -1271,6 +1272,20 @@ ostree_repo_static_delta_reindex (OstreeRepo *repo, if (!lock) return FALSE; + /* Enusre that the "indexed-deltas" option is set on the config, so we know this when pulling */ + if (!ot_keyfile_get_boolean_with_default (repo->config, "core", + "indexed-deltas", FALSE, + &opt_indexed_deltas, error)) + return FALSE; + + if (!opt_indexed_deltas) + { + g_autoptr(GKeyFile) config = ostree_repo_copy_config (repo); + g_key_file_set_boolean (config, "core", "indexed-deltas", TRUE); + if (!ostree_repo_write_config (repo, config, error)) + return FALSE; + } + deltas_to_commit_ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)null_or_ptr_array_unref); if (opt_to_commit == NULL) |