From da00891688a8ce92e32d63dfffbd72d0c147c5b0 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 6 Mar 2012 07:56:30 -0500 Subject: [PATCH] core: Allow 'rev-parse' to resolve multiple revs --- src/ostree/ot-builtin-rev-parse.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ostree/ot-builtin-rev-parse.c b/src/ostree/ot-builtin-rev-parse.c index b60a6082..5d4bf73c 100644 --- a/src/ostree/ot-builtin-rev-parse.c +++ b/src/ostree/ot-builtin-rev-parse.c @@ -41,6 +41,7 @@ ostree_builtin_rev_parse (int argc, char **argv, GFile *repo_path, GError **erro char *resolved_rev = NULL; GVariant *variant = NULL; char *formatted_variant = NULL; + int i; context = g_option_context_new ("REV - Output the target of a rev"); g_option_context_add_main_entries (context, options, NULL); @@ -57,12 +58,14 @@ ostree_builtin_rev_parse (int argc, char **argv, GFile *repo_path, GError **erro ot_util_usage_error (context, "REV must be specified", error); goto out; } - rev = argv[1]; - - if (!ostree_repo_resolve_rev (repo, rev, FALSE, &resolved_rev, error)) - goto out; - - g_print ("%s\n", resolved_rev); + for (i = 1; i < argc; i++) + { + rev = argv[i]; + g_free (resolved_rev); + if (!ostree_repo_resolve_rev (repo, rev, FALSE, &resolved_rev, error)) + goto out; + g_print ("%s\n", resolved_rev); + } ret = TRUE; out: