rev-list/log: factor out revision mark generation
Currently, we have identical code for generating revision marks ('<', '>', '-') in 5 places. Factor out the code to a single function get_revision_mark() for easier maintenance and extensibility. Note that the check for !!revs in graph.c (which gets removed effectively by this patch) is superfluous. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
24852d9171
commit
1df2d656cc
17
graph.c
17
graph.c
@ -798,22 +798,9 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)
|
||||
}
|
||||
|
||||
/*
|
||||
* If revs->left_right is set, print '<' for commits that
|
||||
* come from the left side, and '>' for commits from the right
|
||||
* side.
|
||||
* get_revision_mark() handles all other cases without assert()
|
||||
*/
|
||||
if (graph->revs && graph->revs->left_right) {
|
||||
if (graph->commit->object.flags & SYMMETRIC_LEFT)
|
||||
strbuf_addch(sb, '<');
|
||||
else
|
||||
strbuf_addch(sb, '>');
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print '*' in all other cases
|
||||
*/
|
||||
strbuf_addch(sb, '*');
|
||||
strbuf_addstr(sb, get_revision_mark(graph->revs, graph->commit));
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user