From d94d36453dfe079647aadde7e293fcac74c8e4fc Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 31 Dec 2008 12:55:33 -0500 Subject: [PATCH] Don't use view->cmd to share state in the blame view --- tig.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tig.c b/tig.c index d2bc2dd..fe57bf4 100644 --- a/tig.c +++ b/tig.c @@ -3630,7 +3630,7 @@ parse_blame_commit(struct view *view, const char *text, int *blamed) } static bool -blame_read_file(struct view *view, const char *line) +blame_read_file(struct view *view, const char *line, bool *read_file) { if (!line) { FILE *pipe = NULL; @@ -3639,7 +3639,6 @@ blame_read_file(struct view *view, const char *line) pipe = popen(view->cmd, "r"); else if (!view->parent) die("No blame exist for %s", view->vid); - view->cmd[0] = 0; if (!pipe) { report("Failed to load blame data"); return TRUE; @@ -3647,6 +3646,7 @@ blame_read_file(struct view *view, const char *line) fclose(view->pipe); view->pipe = pipe; + *read_file = FALSE; return FALSE; } else { @@ -3678,14 +3678,16 @@ blame_read(struct view *view, char *line) static struct blame_commit *commit = NULL; static int blamed = 0; static time_t author_time; + static bool read_file = TRUE; - if (*view->cmd) - return blame_read_file(view, line); + if (read_file) + return blame_read_file(view, line, &read_file); if (!line) { /* Reset all! */ commit = NULL; blamed = 0; + read_file = TRUE; string_format(view->ref, "%s", view->vid); if (view_is_displayed(view)) { update_view_title(view); -- 2.32.0.93.g670b81a890