main: Code cleanup by passing OstreeRepo * directly to builtins

It turns out every builtin (with one special exception) that takes a
repo argument did the same thing; let's just centralize it.  The
special exception was "ostree init --repo=foo" where foo is expected
to *not* actually be a repo.  In that case, simply skip the
ostree_repo_check() invocation.

https://bugzilla.gnome.org/show_bug.cgi?id=706762
This commit is contained in:
Colin Walters committed 2013-08-25 15:28:23 -04:00
1 parent 6c61b19107
commit edfa76fad5
27 files changed
+99 -140

No files matched your search

+1 -6
View File
@@ -55,13 +55,12 @@ cat_one_file (GFile *f,
}
gboolean
ostree_builtin_cat (int argc, char **argv, GFile *repo_path, GCancellable *cancellable, GError **error)
ostree_builtin_cat (int argc, char **argv, OstreeRepo *repo, GCancellable *cancellable, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
int i;
const char *rev;
gs_unref_object OstreeRepo *repo = NULL;
gs_unref_object GOutputStream *stdout_stream = NULL;
gs_unref_object GFile *root = NULL;
gs_unref_object GFile *f = NULL;
@@ -72,10 +71,6 @@ ostree_builtin_cat (int argc, char **argv, GFile *repo_path, GCancellable *cance
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
if (argc <= 2)
{
ot_util_usage_error (context, "An COMMIT and at least one PATH argument are required", error);