[ostree] main: Fix previous commit to find repo in cwd over /ostree/repo



commit 89430bbe719d72f9f7209684d58fdb558c2cffce
Author: Colin Walters <walters verbum org>
Date:   Wed Jul 24 14:46:53 2013 -0400

    main: Fix previous commit to find repo in cwd over /ostree/repo
    
    The tests when run inside gnome-ostree broke, and this is better
    behavior.

 src/ostree/ot-main.c |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c
index ff6bd9e..590c1e3 100644
--- a/src/ostree/ot-main.c
+++ b/src/ostree/ot-main.c
@@ -110,11 +110,6 @@ ostree_run (int    argc,
 
   have_repo_arg = g_str_has_prefix (argv[1], "--repo=");
 
-  if (have_repo_arg)
-    repo = argv[1] + strlen ("--repo=");
-  else if (g_file_test (host_repo_path, G_FILE_TEST_EXISTS))
-    repo = host_repo_path;
-
   if (!have_repo_arg)
     {
       arg_off = 2;
@@ -143,13 +138,15 @@ ostree_run (int    argc,
 
   g_set_prgname (g_strdup_printf ("ostree %s", cmd));
 
-  if (repo == NULL && !(command->flags & OSTREE_BUILTIN_FLAG_NO_REPO))
+  if (!(command->flags & OSTREE_BUILTIN_FLAG_NO_REPO))
     {
-      if (g_file_test ("objects", G_FILE_TEST_IS_DIR)
-          && g_file_test ("config", G_FILE_TEST_IS_REGULAR))
-        {
-          repo = ".";
-        }
+      if (have_repo_arg)
+        repo = argv[1] + strlen ("--repo=");
+      else if (g_file_test ("objects", G_FILE_TEST_IS_DIR)
+               && g_file_test ("config", G_FILE_TEST_IS_REGULAR))
+        repo = ".";
+      else if (g_file_test (host_repo_path, G_FILE_TEST_EXISTS))
+        repo = host_repo_path;
       else
         {
           g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]