summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-refs.c
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2016-03-02 10:48:52 +0100
committerColin Walters <walters@verbum.org>2016-03-02 14:53:14 -0500
commit6d73a620e19dfc982fa08363aed441e0175c8d7b (patch)
tree72384025732ee3b5a886597fcf0f1c3361a1383b /src/ostree/ot-builtin-refs.c
parent3e3621b7b679a0975a84af168b1239324e43e324 (diff)
downloadostree-6d73a620e19dfc982fa08363aed441e0175c8d7b.tar.gz
refs: Add argument --list to print the full ref name
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'src/ostree/ot-builtin-refs.c')
-rw-r--r--src/ostree/ot-builtin-refs.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/ostree/ot-builtin-refs.c b/src/ostree/ot-builtin-refs.c
index dabb285c..af90c841 100644
--- a/src/ostree/ot-builtin-refs.c
+++ b/src/ostree/ot-builtin-refs.c
@@ -27,9 +27,11 @@
#include "ostree.h"
static gboolean opt_delete;
+static gboolean opt_list;
static GOptionEntry options[] = {
{ "delete", 0, 0, G_OPTION_ARG_NONE, &opt_delete, "Delete refs which match PREFIX, rather than listing them", NULL },
+ { "list", 0, 0, G_OPTION_ARG_NONE, &opt_list, "Do not remove the prefix from the refs", NULL },
{ NULL }
};
@@ -40,11 +42,17 @@ static gboolean do_ref (OstreeRepo *repo, const char *refspec_prefix, GCancellab
gpointer hashkey, hashvalue;
gboolean ret = FALSE;
- if (!opt_delete)
+ if (opt_delete || opt_list)
{
- if (!ostree_repo_list_refs (repo, refspec_prefix, &refs, cancellable, error))
+ if (!ostree_repo_list_refs_ext (repo, refspec_prefix, &refs, OSTREE_REPO_LIST_REFS_EXT_NONE,
+ cancellable, error))
goto out;
+ }
+ else if (!ostree_repo_list_refs (repo, refspec_prefix, &refs, cancellable, error))
+ goto out;
+ if (!opt_delete)
+ {
g_hash_table_iter_init (&hashiter, refs);
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{
@@ -54,10 +62,6 @@ static gboolean do_ref (OstreeRepo *repo, const char *refspec_prefix, GCancellab
}
else
{
- if (!ostree_repo_list_refs_ext (repo, refspec_prefix, &refs, OSTREE_REPO_LIST_REFS_EXT_NONE,
- cancellable, error))
- goto out;
-
g_hash_table_iter_init (&hashiter, refs);
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{