Code

begin_update: simplify control flow
authorJonas Fonseca <fonseca@diku.dk>
Wed, 18 Nov 2009 03:43:28 +0000 (22:43 -0500)
committerJonas Fonseca <fonseca@diku.dk>
Wed, 18 Nov 2009 04:31:31 +0000 (23:31 -0500)
tig.c

diff --git a/tig.c b/tig.c
index c4d2634380b9ad01c6dcdd401d8941c2fe74d1db..af8e19695425162eed687d2bdf14330137b4bdb3 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -2997,15 +2997,11 @@ begin_update(struct view *view, bool refresh)
        if (view->pipe)
                end_update(view, TRUE);
 
-       if (refresh) {
-               if (!start_io(&view->io))
-                       return FALSE;
-
-       } else {
+       if (!refresh) {
                if (view->ops->prepare) {
                        if (!view->ops->prepare(view))
                                return FALSE;
-               } else if (!run_io_rd(&view->io, view->ops->argv, FORMAT_ALL)) {
+               } else if (!init_io_rd(&view->io, view->ops->argv, NULL, FORMAT_ALL)) {
                        return FALSE;
                }
 
@@ -3016,6 +3012,9 @@ begin_update(struct view *view, bool refresh)
                string_copy_rev(view->ref, view->id);
        }
 
+       if (!start_io(&view->io))
+               return FALSE;
+
        setup_update(view, view->id);
 
        return TRUE;
@@ -4545,7 +4544,7 @@ tree_prepare(struct view *view)
                opt_path[0] = 0;
        }
 
-       return run_io_rd_dir(&view->io, view->ops->argv, opt_cdup, FORMAT_ALL);
+       return init_io_rd(&view->io, view->ops->argv, opt_cdup, FORMAT_ALL);
 }
 
 static const char *tree_argv[SIZEOF_ARG] = {