X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=tig.c;h=047b853b67396961cd12361489cb9a911843c140;hb=745649df49e55942b95ee2aacd619bb1cf6359b0;hp=f562218376a5f17edc4722ce7e2fb25b4b985ec5;hpb=4bac5372c9b08d6ced9eab474d97df311cdf0887;p=tig.git diff --git a/tig.c b/tig.c index f562218..047b853 100644 --- a/tig.c +++ b/tig.c @@ -2500,22 +2500,6 @@ setup_update(struct view *view, const char *vid) view->start_time = time(NULL); } -static bool -prepare_update(struct view *view, const char *dir, const char *argv[]) -{ - if (view->pipe) - io_done(view->pipe); - view->dir = dir; - return argv_copy(&view->argv, argv); -} - -static bool -start_update(struct view *view, const char **argv, const char *dir) -{ - return prepare_update(view, dir, argv) && - io_run(&view->io, IO_RD, dir, view->argv); -} - static bool begin_update(struct view *view, const char *dir, const char **argv, enum open_flags flags) { @@ -2784,7 +2768,11 @@ open_argv(struct view *prev, struct view *view, const char *argv[], const char * { enum request request = view - views + REQ_OFFSET + 1; - if (!prepare_update(view, dir, argv)) { + if (view->pipe) + end_update(view, TRUE); + view->dir = dir; + + if (!argv_copy(&view->argv, argv)) { report("Failed to open %s view: %s", view->name, io_strerror(&view->io)); } else { open_view(prev, request, flags | OPEN_PREPARED); @@ -2794,17 +2782,9 @@ open_argv(struct view *prev, struct view *view, const char *argv[], const char * static void open_file(struct view *prev, struct view *view, const char *file, enum open_flags flags) { - enum request request = view - views + REQ_OFFSET + 1; const char *file_argv[] = { opt_cdup, file , NULL }; - if (view->pipe) - end_update(view, TRUE); - view->dir = opt_cdup; - if (!argv_copy(&view->argv, file_argv)) { - report("Failed to load %s: out of memory", file); - } else { - open_view(prev, request, flags | OPEN_PREPARED); - } + open_argv(prev, view, file_argv, opt_cdup, flags); } static void @@ -3730,11 +3710,10 @@ tree_read_date(struct view *view, char *text, bool *read_date) return TRUE; } else if (!text) { - char *path = *opt_path ? opt_path : "."; /* Find next entry to process */ const char *log_file[] = { "git", "log", "--no-color", "--pretty=raw", - "--cc", "--raw", view->id, "--", path, NULL + "--cc", "--raw", view->id, "--", "%(directory)", NULL }; if (!view->lines) { @@ -3743,7 +3722,7 @@ tree_read_date(struct view *view, char *text, bool *read_date) return TRUE; } - if (!start_update(view, log_file, opt_cdup)) { + if (!begin_update(view, opt_cdup, log_file, OPEN_EXTRA)) { report("Failed to load tree data"); return TRUE; } @@ -4681,12 +4660,11 @@ branch_open(struct view *view, enum open_flags flags) "--simplify-by-decoration", "--all", NULL }; - if (!start_update(view, branch_log, NULL)) { + if (!begin_update(view, NULL, branch_log, flags)) { report("Failed to load branch data"); return TRUE; } - setup_update(view, view->id); branch_open_visitor(view, &branch_all); foreach_ref(branch_open_visitor, view); view->p_restore = TRUE;