summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 984c196)
raw | patch | inline | side by side (parent: 984c196)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 31 Dec 2008 18:23:43 +0000 (13:23 -0500) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 31 Dec 2008 19:20:08 +0000 (14:20 -0500) |
Doing it in blame_open after starting the command makes error handling
harder and the code was indeed buggy.
harder and the code was indeed buggy.
tig.c | patch | blob | history |
index bcbc5fa027907a78e87946c558442595774917f2..ec97f564d8e878e0bfcce70f400cd3f489238463 100644 (file)
--- a/tig.c
+++ b/tig.c
return FALSE;
}
- if (!string_format(view->cmd, BLAME_INCREMENTAL_CMD, ref, path))
- return FALSE;
-
reset_view(view);
string_format(view->ref, "%s ...", opt_file);
string_copy_rev(view->vid, opt_file);
blame_read_file(struct view *view, const char *line, bool *read_file)
{
if (!line) {
+ char ref[SIZEOF_STR] = "";
+ char path[SIZEOF_STR];
FILE *pipe = NULL;
- if (view->lines > 0)
- pipe = popen(view->cmd, "r");
- else if (!view->parent)
+ if (view->lines == 0 && !view->parent)
die("No blame exist for %s", view->vid);
- if (!pipe) {
+
+ if (view->lines == 0 ||
+ sq_quote(path, 0, opt_file) >= sizeof(path) ||
+ (*opt_ref && sq_quote(ref, 0, opt_ref) >= sizeof(ref)) ||
+ !string_format(view->cmd, BLAME_INCREMENTAL_CMD, ref, path) ||
+ !(pipe = popen(view->cmd, "r"))) {
report("Failed to load blame data");
return TRUE;
}