From: Philip Withnall Date: Wed, 7 Jun 2017 13:32:29 +0000 (+0100) Subject: lib/repo: Omit deltas from the summary file if there are none X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~36^2~35 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=59ffce73c8c386f70c850f318934f1581ef05e7a;p=ostree.git lib/repo: Omit deltas from the summary file if there are none If there are no deltas to be listed in the summary file, don’t bother including the key for them in the additional metadata section of the file. This saves a few bytes in some cases. Signed-off-by: Philip Withnall Closes: #911 Approved by: cgwalters --- diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index c1aedb91..0d20c25b 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -4561,7 +4561,8 @@ ostree_repo_regenerate_summary (OstreeRepo *self, g_variant_dict_insert_value (&deltas_builder, delta_names->pdata[i], ot_gvariant_new_bytearray (csum, 32)); } - g_variant_dict_insert_value (&additional_metadata_builder, OSTREE_SUMMARY_STATIC_DELTAS, g_variant_dict_end (&deltas_builder)); + if (delta_names->len > 0) + g_variant_dict_insert_value (&additional_metadata_builder, OSTREE_SUMMARY_STATIC_DELTAS, g_variant_dict_end (&deltas_builder)); } { diff --git a/tests/test-summary-view.sh b/tests/test-summary-view.sh index 5b52b691..60855eb1 100755 --- a/tests/test-summary-view.sh +++ b/tests/test-summary-view.sh @@ -51,7 +51,6 @@ ${OSTREE} summary --view > summary.txt assert_file_has_content_literal summary.txt "* main" assert_file_has_content_literal summary.txt "* other" assert_file_has_content_literal summary.txt "ostree.summary.last-modified" -assert_file_has_content_literal summary.txt "Static Deltas (ostree.static-deltas): {}" assert_file_has_content_literal summary.txt "Timestamp (ostree.commit.timestamp): " echo "ok view summary"