lib/config: Deprecate commit-update-summary option

Now that we have `auto-update-summary`, there is no point in having
`commit-update-summary`. The latter also only had an effect through
the `commit` CLI command, whereas the former is embedded directly in
libostree.

There is one corner case that slips through: `commit` would update the
summary file even if orphan commits were created, which we no longer do
here. I can't imagine anyone relying on this, so it seems safe to drop.

Closes: #1689

Closes: #1693
Approved by: mwleeds
This commit is contained in:
Jonathan Lebon 2018-07-30 10:54:15 -04:00 committed by Atomic Bot
parent 786ee6bdec
commit 72a54fa877
3 changed files with 25 additions and 43 deletions

View File

@ -86,23 +86,23 @@ Boston, MA 02111-1307, USA.
<listitem><para>Currently, this must be set to <literal>1</literal>.</para></listitem> <listitem><para>Currently, this must be set to <literal>1</literal>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>commit-update-summary</varname></term>
<listitem><para>Boolean value controlling whether or not to
automatically update the summary file after a commit. Defaults
to <literal>false</literal>.</para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>auto-update-summary</varname></term> <term><varname>auto-update-summary</varname></term>
<listitem><para>Boolean value controlling whether or not to <listitem><para>Boolean value controlling whether or not to
automatically update the summary file after any ref is added, automatically update the summary file after any ref is added,
removed, or updated. This covers a superset of the cases covered by removed, or updated. Other modifications which may render a
commit-update-summary, with the exception of orphan commits which summary file stale (like static deltas, or collection IDs) do
shouldn't affect the summary anyway. Defaults to <literal>false</literal>. not currently trigger an auto-update.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>commit-update-summary</varname></term>
<listitem><para>This option is deprecated. Use
<literal>auto-update-summary</literal> instead, for which this
option is now an alias.</para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>fsync</varname></term> <term><varname>fsync</varname></term>
<listitem><para>Boolean value controlling whether or not to <listitem><para>Boolean value controlling whether or not to

View File

@ -5385,8 +5385,7 @@ summary_add_ref_entry (OstreeRepo *self,
* regular, setting the `ostree.summary.expires` key in @additional_metadata * regular, setting the `ostree.summary.expires` key in @additional_metadata
* will aid clients in working out when to check for updates. * will aid clients in working out when to check for updates.
* *
* It is regenerated automatically after a commit if * It is regenerated automatically after any ref is
* `core/commit-update-summary` is set, and automatically after any ref is
* added, removed, or updated if `core/auto-update-summary` is set. * added, removed, or updated if `core/auto-update-summary` is set.
* *
* If the `core/collection-id` key is set in the configuration, it will be * If the `core/collection-id` key is set in the configuration, it will be
@ -5593,20 +5592,31 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
return TRUE; return TRUE;
} }
/* Regenerate the summary if `core/auto-update-summary` is set */ /* Regenerate the summary if `core/auto-update-summary` is set. We default to FALSE for
* this setting because OSTree supports multiple processes committing to the same repo (but
* different refs) concurrently, and in fact gnome-continuous actually does this. In that
* context it's best to update the summary explicitly once at the end of multiple
* transactions instead of automatically here. `auto-update-summary` only updates
* atomically within a transaction. */
gboolean gboolean
_ostree_repo_maybe_regenerate_summary (OstreeRepo *self, _ostree_repo_maybe_regenerate_summary (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean auto_update_summary; gboolean auto_update_summary;
if (!ot_keyfile_get_boolean_with_default (self->config, "core", if (!ot_keyfile_get_boolean_with_default (self->config, "core",
"auto-update-summary", FALSE, "auto-update-summary", FALSE,
&auto_update_summary, error)) &auto_update_summary, error))
return FALSE; return FALSE;
if (auto_update_summary && /* Deprecated alias for `auto-update-summary`. */
gboolean commit_update_summary;
if (!ot_keyfile_get_boolean_with_default (self->config, "core",
"commit-update-summary", FALSE,
&commit_update_summary, error))
return FALSE;
if ((auto_update_summary || commit_update_summary) &&
!ostree_repo_regenerate_summary (self, NULL, cancellable, error)) !ostree_repo_regenerate_summary (self, NULL, cancellable, error))
return FALSE; return FALSE;

View File

@ -753,7 +753,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
if (!skip_commit) if (!skip_commit)
{ {
guint64 timestamp; guint64 timestamp;
gboolean auto_update_summary;
if (!opt_no_bindings) if (!opt_no_bindings)
{ {
@ -823,33 +822,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error)) if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error))
goto out; goto out;
if (!ot_keyfile_get_boolean_with_default (ostree_repo_get_config (repo), "core",
"auto-update-summary", FALSE,
&auto_update_summary, error))
goto out;
/* No need to update it again if we did for each ref change */
if (opt_orphan || !auto_update_summary)
{
gboolean commit_update_summary;
/* The default for this option is FALSE, even for archive repos,
* because ostree supports multiple processes committing to the same
* repo (but different refs) concurrently, and in fact gnome-continuous
* actually does this. In that context it's best to update the summary
* explicitly instead of automatically here. */
if (!ot_keyfile_get_boolean_with_default (ostree_repo_get_config (repo), "core",
"commit-update-summary", FALSE,
&commit_update_summary, error))
goto out;
if (commit_update_summary && !ostree_repo_regenerate_summary (repo,
NULL,
cancellable,
error))
goto out;
}
} }
else else
{ {