diff --git a/src/libostree/ostree-repo-refs.c b/src/libostree/ostree-repo-refs.c index be2eb59a..fec36420 100644 --- a/src/libostree/ostree-repo-refs.c +++ b/src/libostree/ostree-repo-refs.c @@ -1247,7 +1247,9 @@ _ostree_repo_update_collection_refs (OstreeRepo *self, * (ostree_repo_get_collection_id()). * * If you want to exclude refs from `refs/remotes`, use - * %OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES in @flags. + * %OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES in @flags. Similarly use + * %OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS to exclude refs from + * `refs/mirrors`. * * Returns: %TRUE on success, %FALSE otherwise * Since: 2018.6 @@ -1269,9 +1271,12 @@ ostree_repo_list_collection_refs (OstreeRepo *self, if (match_collection_id != NULL && !ostree_validate_collection_id (match_collection_id, error)) return FALSE; - const gchar *refs_dirs[] = { "refs/mirrors", "refs/remotes", NULL }; - if (flags & OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES) - refs_dirs[1] = NULL; + g_autoptr(GPtrArray) refs_dirs = g_ptr_array_new (); + if (!(flags & OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS)) + g_ptr_array_add (refs_dirs, "refs/mirrors"); + if (!(flags & OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES)) + g_ptr_array_add (refs_dirs, "refs/remotes"); + g_ptr_array_add (refs_dirs, NULL); g_autoptr(GHashTable) ret_all_refs = NULL; @@ -1301,7 +1306,7 @@ ostree_repo_list_collection_refs (OstreeRepo *self, g_string_truncate (base_path, 0); - for (const char **iter = refs_dirs; iter && *iter; iter++) + for (const char **iter = (const char **)refs_dirs->pdata; iter && *iter; iter++) { const char *refs_dir = *iter; gboolean refs_dir_exists = FALSE; diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index 7eb983cf..d24077c9 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -499,11 +499,13 @@ gboolean ostree_repo_list_refs (OstreeRepo *self, * @OSTREE_REPO_LIST_REFS_EXT_NONE: No flags. * @OSTREE_REPO_LIST_REFS_EXT_ALIASES: Only list aliases. Since: 2017.10 * @OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES: Exclude remote refs. Since: 2017.11 + * @OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS: Exclude mirrored refs. Since: 2019.2 */ typedef enum { OSTREE_REPO_LIST_REFS_EXT_NONE = 0, OSTREE_REPO_LIST_REFS_EXT_ALIASES = (1 << 0), OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES = (1 << 1), + OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS = (1 << 2), } OstreeRepoListRefsExtFlags; _OSTREE_PUBLIC