chiark
/
gitweb
/
~mdw
/
tig
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e314c36
)
main_read: cleanup and simplify
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
|
blame
|
history
diff --git
a/tig.c
b/tig.c
index ca380a30a6d3b9eac6eed506a78c3b09ee96cf66..b71217337935aa620c2a37d6df8b1dbedbb341df 100644
(file)
--- a/
tig.c
+++ b/
tig.c
@@
-3073,8
+3073,7
@@
main_read(struct view *view, char *line)
{
static struct rev_graph *graph = graph_stacks;
enum line_type type;
{
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);
if (!line) {
update_rev_graph(graph);
@@
-3082,26
+3081,25
@@
main_read(struct view *view, char *line)
}
type = get_line_type(line);
}
type = get_line_type(line);
-
- switch (type) {
- case LINE_COMMIT:
+ if (type == LINE_COMMIT) {
commit = calloc(1, sizeof(struct commit));
if (!commit)
return FALSE;
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);
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:
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:
break;
case LINE_AUTHOR:
@@
-3113,7
+3111,7
@@
main_read(struct view *view, char *line)
char *nameend = strchr(ident, '<');
char *emailend = strchr(ident, '>');
char *nameend = strchr(ident, '<');
char *emailend = strchr(ident, '>');
- if (!
commit || !
nameend || !emailend)
+ if (!nameend || !emailend)
break;
update_rev_graph(graph);
break;
update_rev_graph(graph);
@@
-3155,9
+3153,6
@@
main_read(struct view *view, char *line)
break;
}
default:
break;
}
default:
- if (!commit)
- break;
-
/* Fill in the commit title if it has not already been set. */
if (commit->title[0])
break;
/* Fill in the commit title if it has not already been set. */
if (commit->title[0])
break;