history: Omit entries for appstream refs

Currently we include entries in the output of the history command for
pulls of appstream refs, e.g. "appstream2/x86_64". However since they
don't have an application ID the Application column shows up blank and
it seems like a pull of nothing which is confusing. These are basically
an implementation detail like the temp repo pulls we already exclude, so
I think it makes sense to exclude them from the output.

It would also make sense to exclude pulls of ostree-metadata refs, but
for some reason I don't see those in practice, even with a collection ID
set on the remote.

(cherry picked from commit fbad9641b73632c0577d0dc9c38f1ea9c8aa6223)
This commit is contained in:
Phaedrus Leeds 2021-10-28 11:16:22 -07:00 committed by Phaedrus Leeds
parent 4b37f88c68
commit 2cfce0f1fd

View File

@ -160,8 +160,20 @@ print_history (GPtrArray *dirs,
while ((reverse && sd_journal_previous (j) > 0) ||
(!reverse && sd_journal_next (j) > 0))
{
g_autofree char *ref_str = NULL;
/* determine whether to skip this entry */
ref_str = get_field (j, "REF", error);
if (*error)
return FALSE;
/* Appstream pulls are probably not interesting, and they are confusing
* since by default we include the Application column which shows up blank.
*/
if (ref_str && ref_str[0] && g_str_has_prefix (ref_str, "appstream"))
continue;
if (dirs)
{
gboolean include = FALSE;
@ -217,13 +229,8 @@ print_history (GPtrArray *dirs,
strcmp (columns[k].name, "arch") == 0 ||
strcmp (columns[k].name, "branch") == 0)
{
g_autofree char *ref_str = NULL;
g_autofree char *value = NULL;
ref_str = get_field (j, "REF", error);
if (*error)
return FALSE;
if (ref_str && ref_str[0] &&
!is_flatpak_ref (ref_str) &&
g_strcmp0 (ref_str, OSTREE_REPO_METADATA_REF) != 0)
@ -231,11 +238,6 @@ print_history (GPtrArray *dirs,
if (strcmp (columns[k].name, "ref") == 0)
value = g_strdup (ref_str);
else if (strcmp (columns[k].name, "arch") == 0)
{
if (ref_str != NULL)
value = flatpak_get_arch_for_ref (ref_str);
}
else if (ref_str && ref_str[0] &&
(g_str_has_prefix (ref_str, "app/") ||
g_str_has_prefix (ref_str, "runtime/")))
@ -248,6 +250,8 @@ print_history (GPtrArray *dirs,
{
if (strcmp (columns[k].name, "application") == 0)
value = flatpak_decomposed_dup_id (ref);
else if (strcmp (columns[k].name, "arch") == 0)
value = flatpak_decomposed_dup_arch (ref);
else
value = flatpak_decomposed_dup_branch (ref);
}