From: Jonas Fonseca Date: Wed, 31 Dec 2008 18:11:58 +0000 (-0500) Subject: Minor simplification of blame_open X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=984c196588405ccf2ad840838a72f93d6915c189;p=tig.git Minor simplification of blame_open --- 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;