From 984c196588405ccf2ad840838a72f93d6915c189 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 31 Dec 2008 13:11:58 -0500 Subject: [PATCH] Minor simplification of blame_open --- tig.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tig.c b/tig.c index fe57bf4..bcbc5fa 100644 --- a/tig.c +++ b/tig.c @@ -3528,21 +3528,14 @@ blame_open(struct view *view) if (*opt_ref && sq_quote(ref, 0, opt_ref) >= sizeof(ref)) return FALSE; - if (*opt_ref) { - if (!string_format(view->cmd, BLAME_CAT_FILE_CMD, ref, path)) - return FALSE; - } else { - view->pipe = fopen(opt_file, "r"); - if (!view->pipe && - !string_format(view->cmd, BLAME_CAT_FILE_CMD, "HEAD", path)) + if (*opt_ref || !(view->pipe = fopen(opt_file, "r"))) { + const char *id = *opt_ref ? ref : "HEAD"; + + if (!string_format(view->cmd, BLAME_CAT_FILE_CMD, id, path) || + !(view->pipe = popen(view->cmd, "r"))) return FALSE; } - if (!view->pipe) - view->pipe = popen(view->cmd, "r"); - if (!view->pipe) - return FALSE; - if (!string_format(view->cmd, BLAME_INCREMENTAL_CMD, ref, path)) return FALSE; -- 2.32.0.93.g670b81a890