summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e314c36)
raw | patch | inline | side by side (parent: e314c36)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 30 May 2007 18:53:20 +0000 (20:53 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 30 May 2007 19:01:12 +0000 (21:01 +0200) |
tig.c | patch | blob | history |
index ca380a30a6d3b9eac6eed506a78c3b09ee96cf66..b71217337935aa620c2a37d6df8b1dbedbb341df 100644 (file)
--- a/tig.c
+++ b/tig.c
{
static struct rev_graph *graph = graph_stacks;
enum line_type type;
- struct commit *commit = view->lines
- ? view->line[view->lines - 1].data : NULL;
+ struct commit *commit;
if (!line) {
update_rev_graph(graph);
}
type = get_line_type(line);
-
- switch (type) {
- case LINE_COMMIT:
+ if (type == LINE_COMMIT) {
commit = calloc(1, sizeof(struct commit));
if (!commit)
return FALSE;
- line += STRING_SIZE("commit ");
-
- string_copy_rev(commit->id, line);
+ string_copy_rev(commit->id, line + STRING_SIZE("commit "));
commit->refs = get_refs(commit->id);
graph->commit = commit;
add_line_data(view, commit, LINE_MAIN_COMMIT);
- break;
+ return TRUE;
+ }
+ if (!view->lines)
+ return TRUE;
+ commit = view->line[view->lines - 1].data;
+
+ switch (type) {
case LINE_PARENT:
- if (commit) {
- line += STRING_SIZE("parent ");
- push_rev_graph(graph->parents, line);
- }
+ push_rev_graph(graph->parents, line + STRING_SIZE("parent "));
break;
case LINE_AUTHOR:
char *nameend = strchr(ident, '<');
char *emailend = strchr(ident, '>');
- if (!commit || !nameend || !emailend)
+ if (!nameend || !emailend)
break;
update_rev_graph(graph);
break;
}
default:
- if (!commit)
- break;
-
/* Fill in the commit title if it has not already been set. */
if (commit->title[0])
break;