summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d94d364)
raw | patch | inline | side by side (parent: d94d364)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 31 Dec 2008 18:11:58 +0000 (13:11 -0500) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 31 Dec 2008 18:46:38 +0000 (13:46 -0500) |
tig.c | patch | blob | history |
index fe57bf4c6bb751dc4c5cb01204127781046819be..bcbc5fa027907a78e87946c558442595774917f2 100644 (file)
--- a/tig.c
+++ b/tig.c
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;