summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9b2d063)
raw | patch | inline | side by side (parent: 9b2d063)
author | Jonas Fonseca <jonas.fonseca@savoirfairelinux.com> | |
Wed, 2 Jun 2010 15:51:03 +0000 (11:51 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 3 Jun 2010 01:15:51 +0000 (21:15 -0400) |
tig.c | patch | blob | history |
index f842de567b03108f63dbfe44f3ec7af3bed82a9d..bfa88e8c4650bd68d33909ec7797861ff4ff3404 100644 (file)
--- a/tig.c
+++ b/tig.c
return io_complete(IO_AP, argv, NULL, -1);
}
-static bool
-io_run_rd(struct io *io, const char **argv, const char *dir)
-{
- return io_format(io, dir, IO_RD, argv, FORMAT_NONE) && io_start(io);
-}
-
static bool
io_eof(struct io *io)
{
return io_format(&view->io, dir, IO_RD, argv, FORMAT_NONE);
}
+static bool
+start_update(struct view *view, const char **argv, const char *dir)
+{
+ if (view->pipe)
+ io_done(view->pipe);
+ return io_format(&view->io, dir, IO_RD, argv, FORMAT_NONE) &&
+ io_start(&view->io);
+}
+
static bool
prepare_update_file(struct view *view, const char *name)
{
"git", "log", "--no-color", "--pretty=raw",
"--cc", "--raw", view->id, "--", path, NULL
};
- struct io io = {};
if (!view->lines) {
tree_entry(view, LINE_TREE_HEAD, opt_path, NULL, NULL);
return TRUE;
}
- if (!io_run_rd(&io, log_file, opt_cdup)) {
+ if (!start_update(view, log_file, opt_cdup)) {
report("Failed to load tree data");
return TRUE;
}
- io_done(view->pipe);
- view->io = io;
*read_date = TRUE;
return FALSE;
};
if (!string_format(path, "%s:%s", opt_ref, opt_file) ||
- !io_run_rd(&view->io, blame_cat_file_argv, opt_cdup))
+ !start_update(view, blame_cat_file_argv, opt_cdup))
return FALSE;
}
"git", "blame", "--incremental",
*opt_ref ? opt_ref : "--incremental", "--", opt_file, NULL
};
- struct io io = {};
if (view->lines == 0 && !view->prev)
die("No blame exist for %s", view->vid);
- if (view->lines == 0 || !io_run_rd(&io, blame_argv, opt_cdup)) {
+ if (view->lines == 0 || !start_update(view, blame_argv, opt_cdup)) {
report("Failed to load blame data");
return TRUE;
}
- io_done(view->pipe);
- view->io = io;
*read_file = FALSE;
return FALSE;
"--simplify-by-decoration", "--all", NULL
};
- if (!io_run_rd(&view->io, branch_log, NULL)) {
+ if (!start_update(view, branch_log, NULL)) {
report("Failed to load branch data");
return TRUE;
}