diff options
author | Michael J Gruber <git@drmicha.warpmail.net> | 2011-03-07 13:31:39 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-03-09 13:50:54 -0800 |
commit | 1df2d656cc442dc057e30b6fb130967e5ae19654 (patch) | |
tree | 6290981baed52c65c997e7e0eb172651d9af26ff /revision.c | |
parent | 24852d917104e294726c54803d5c9012997506ca (diff) | |
download | git-1df2d656cc442dc057e30b6fb130967e5ae19654.tar.gz |
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>
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/revision.c b/revision.c index 1fcaeb7902..0de1608d04 100644 --- a/revision.c +++ b/revision.c @@ -2263,3 +2263,19 @@ struct commit *get_revision(struct rev_info *revs) graph_update(revs->graph, c); return c; } + +char *get_revision_mark(const struct rev_info *revs, const struct commit *commit) +{ + if (commit->object.flags & BOUNDARY) + return "-"; + else if (commit->object.flags & UNINTERESTING) + return "^"; + else if (!revs || revs->left_right) { + if (commit->object.flags & SYMMETRIC_LEFT) + return "<"; + else + return ">"; + } else if (revs->graph) + return "*"; + return ""; +} |