summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 37a75ab)
raw | patch | inline | side by side (parent: 37a75ab)
author | Adam Simpkins <adam@adamsimpkins.net> | |
Sun, 25 May 2008 07:07:21 +0000 (00:07 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 25 May 2008 19:06:52 +0000 (12:06 -0700) |
With the --graph option, the graph already outputs 'o' instead of '*'
for boundary commits. Make it emit '<' or '>' when --left-right is
specified.
(This change also disables the '^' prefix for UNINTERESTING commits.
The graph code currently doesn't print anything special for these
commits, since it assumes no UNINTERESTING, non-BOUNDARY commits are
displayed. This is potentially a bug if UNINTERESTING non-BOUNDARY
commits can actually be displayed via some code path.)
[jc: squashed the left-right change from Dscho and Adam's fixup into one]
Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
for boundary commits. Make it emit '<' or '>' when --left-right is
specified.
(This change also disables the '^' prefix for UNINTERESTING commits.
The graph code currently doesn't print anything special for these
commits, since it assumes no UNINTERESTING, non-BOUNDARY commits are
displayed. This is potentially a bug if UNINTERESTING non-BOUNDARY
commits can actually be displayed via some code path.)
[jc: squashed the left-right change from Dscho and Adam's fixup into one]
Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/Documentation/technical/api-history-graph.txt b/Documentation/technical/api-history-graph.txt
index ce1c08ee862b5eeb04a03b0e04caf68b0bdf9520..e9559790a32185b1d4ac8ae72881f4f63f082538 100644 (file)
------------
struct commit *commit;
-struct git_graph *graph = graph_init();
+struct git_graph *graph = graph_init(opts);
while ((commit = get_revision(opts)) != NULL) {
graph_update(graph, commit);
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 54d55cc3a33e55d5c3021eae14b7a771b4e1c23f..b474527402262fa821a53bc2cc0ca53b74014d8e 100644 (file)
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
printf("%lu ", commit->date);
if (header_prefix)
fputs(header_prefix, stdout);
- if (commit->object.flags & BOUNDARY)
- putchar('-');
- else if (commit->object.flags & UNINTERESTING)
- putchar('^');
- else if (revs.left_right) {
- if (commit->object.flags & SYMMETRIC_LEFT)
- putchar('<');
- else
- putchar('>');
+
+ if (!revs.graph) {
+ if (commit->object.flags & BOUNDARY)
+ putchar('-');
+ else if (commit->object.flags & UNINTERESTING)
+ putchar('^');
+ else if (revs.left_right) {
+ if (commit->object.flags & SYMMETRIC_LEFT)
+ putchar('<');
+ else
+ putchar('>');
+ }
}
if (revs.abbrev_commit && revs.abbrev)
fputs(find_unique_abbrev(commit->object.sha1, revs.abbrev),
index add7e4477dfeb5715a13069d233365c8d2dce2c3..dc2c1ec5d77932dc1e30057603d02a79b4d60f94 100644 (file)
--- a/graph.c
+++ b/graph.c
* The commit currently being processed
*/
struct commit *commit;
+ /* The rev-info used for the current traversal */
+ struct rev_info *revs;
/*
* The number of interesting parents that this commit has.
*
int *new_mapping;
};
-struct git_graph *graph_init(void)
+struct git_graph *graph_init(struct rev_info *opt)
{
struct git_graph *graph = xmalloc(sizeof(struct git_graph));
graph->commit = NULL;
+ graph->revs = opt;
graph->num_parents = 0;
graph->expansion_row = 0;
graph->state = GRAPH_PADDING;
if (col_commit == graph->commit) {
seen_this = 1;
- /*
- * If the commit has more than 1 interesting
- * parent, print 'M' to indicate that it is a
- * merge. Otherwise, print '*'.
- *
- * Note that even if this is actually a merge
- * commit, we still print '*' if less than 2 of its
- * parents are interesting.
- */
- if (graph->num_parents > 1)
+
+ if (graph->revs && graph->revs->left_right) {
+ if (graph->commit->object.flags & SYMMETRIC_LEFT)
+ strbuf_addch(sb, '<');
+ else
+ strbuf_addch(sb, '>');
+ } else if (graph->num_parents > 1)
strbuf_addch(sb, 'M');
else
strbuf_addch(sb, '*');
index a7748a5b229b11f0d068ecc2843c1b3a02cac07f..eab4e3daba9812293d4e005c3ebe28f9a97744ce 100644 (file)
--- a/graph.h
+++ b/graph.h
* Create a new struct git_graph.
* The graph should be freed with graph_release() when no longer needed.
*/
-struct git_graph *graph_init();
+struct git_graph *graph_init(struct rev_info *opt);
/*
* Destroy a struct git_graph and free associated memory.
diff --git a/log-tree.c b/log-tree.c
index 1474d1f5d96c9b04b0d5c190f88b2fdefd2ef679..5505606ed6a292cadf1a04ea0b1abc2ca93e3c09 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
if (!opt->verbose_header) {
graph_show_commit(opt->graph);
- if (commit->object.flags & BOUNDARY)
- putchar('-');
- else if (commit->object.flags & UNINTERESTING)
- putchar('^');
- else if (opt->left_right) {
- if (commit->object.flags & SYMMETRIC_LEFT)
- putchar('<');
- else
- putchar('>');
+ if (!opt->graph) {
+ if (commit->object.flags & BOUNDARY)
+ putchar('-');
+ else if (commit->object.flags & UNINTERESTING)
+ putchar('^');
+ else if (opt->left_right) {
+ if (commit->object.flags & SYMMETRIC_LEFT)
+ putchar('<');
+ else
+ putchar('>');
+ }
}
fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
if (opt->print_parents)
fputs(diff_get_color_opt(&opt->diffopt, DIFF_COMMIT), stdout);
if (opt->commit_format != CMIT_FMT_ONELINE)
fputs("commit ", stdout);
- if (commit->object.flags & BOUNDARY)
- putchar('-');
- else if (commit->object.flags & UNINTERESTING)
- putchar('^');
- else if (opt->left_right) {
- if (commit->object.flags & SYMMETRIC_LEFT)
- putchar('<');
- else
- putchar('>');
+
+ if (!opt->graph) {
+ if (commit->object.flags & BOUNDARY)
+ putchar('-');
+ else if (commit->object.flags & UNINTERESTING)
+ putchar('^');
+ else if (opt->left_right) {
+ if (commit->object.flags & SYMMETRIC_LEFT)
+ putchar('<');
+ else
+ putchar('>');
+ }
}
fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),
stdout);
diff --git a/revision.c b/revision.c
index 7142cf96cde81377522e49de5f102a25eaec2d54..1341f3d1259b4a5477ba15258071d0dc74ee519e 100644 (file)
--- a/revision.c
+++ b/revision.c
@@ -1205,7 +1205,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
if (!prefixcmp(arg, "--graph")) {
revs->topo_order = 1;
revs->rewrite_parents = 1;
- revs->graph = graph_init();
+ revs->graph = graph_init(revs);
continue;
}
if (!strcmp(arg, "--root")) {