summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c68d67)
raw | patch | inline | side by side (parent: 3c68d67)
author | Adam Simpkins <adam@adamsimpkins.net> | |
Sat, 24 May 2008 23:02:05 +0000 (16:02 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 25 May 2008 19:22:24 +0000 (12:22 -0700) |
Now get_revision() sorts the boundary commits when topo_order is set.
Since sort_in_topological_order() takes a struct commit_list, it first
places the boundary commits into revs->commits.
Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Since sort_in_topological_order() takes a struct commit_list, it first
places the boundary commits into revs->commits.
Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
graph.c | patch | blob | history | |
revision.c | patch | blob | history |
index 9b3495c4614504f280a28e697091949b47560e34..26b8c5209e280697cc35ffd5313fe3e79681fc43 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -195,16 +195,9 @@ static int graph_is_interesting(struct git_graph *graph, struct commit *commit)
* If revs->boundary is set, commits whose children have
* been shown are always interesting, even if they have the
* UNINTERESTING or TREESAME flags set.
- *
- * However, ignore the commit if SHOWN is set. If SHOWN is set,
- * the commit is interesting, but it has already been printed.
- * This can happen because get_revision() doesn't return the
- * boundary commits in topological order, even when
- * revs->topo_order is set.
*/
if (graph->revs && graph->revs->boundary) {
- if ((commit->object.flags & (SHOWN | CHILD_SHOWN)) ==
- CHILD_SHOWN)
+ if (commit->object.flags & CHILD_SHOWN)
return 1;
}
diff --git a/revision.c b/revision.c
index 181fb0b954d49332602f5fecde7e8c605f916184..fb9924e5af65bc52db588cb5f9be3654b6a5c962 100644 (file)
--- a/revision.c
+++ b/revision.c
}
}
+static void create_boundary_commit_list(struct rev_info *revs)
+{
+ unsigned i;
+ struct commit *c;
+ struct object_array *array = &revs->boundary_commits;
+ struct object_array_entry *objects = array->objects;
+
+ /*
+ * If revs->commits is non-NULL at this point, an error occurred in
+ * get_revision_1(). Ignore the error and continue printing the
+ * boundary commits anyway. (This is what the code has always
+ * done.)
+ */
+ if (revs->commits) {
+ free_commit_list(revs->commits);
+ revs->commits = NULL;
+ }
+
+ /*
+ * Put all of the actual boundary commits from revs->boundary_commits
+ * into revs->commits
+ */
+ for (i = 0; i < array->nr; i++) {
+ c = (struct commit *)(objects[i].item);
+ if (!c)
+ continue;
+ if (!(c->object.flags & CHILD_SHOWN))
+ continue;
+ if (c->object.flags & (SHOWN | BOUNDARY))
+ continue;
+ c->object.flags |= BOUNDARY;
+ commit_list_insert(c, &revs->commits);
+ }
+
+ /*
+ * If revs->topo_order is set, sort the boundary commits
+ * in topological order
+ */
+ sort_in_topological_order(&revs->commits, revs->lifo);
+}
+
static struct commit *get_revision_internal(struct rev_info *revs)
{
struct commit *c = NULL;
struct commit_list *l;
if (revs->boundary == 2) {
- unsigned i;
- struct object_array *array = &revs->boundary_commits;
- struct object_array_entry *objects = array->objects;
- for (i = 0; i < array->nr; i++) {
- c = (struct commit *)(objects[i].item);
- if (!c)
- continue;
- if (!(c->object.flags & CHILD_SHOWN))
- continue;
- if (!(c->object.flags & SHOWN))
- break;
- }
- if (array->nr <= i)
- return NULL;
-
- c->object.flags |= SHOWN | BOUNDARY;
+ /*
+ * All of the normal commits have already been returned,
+ * and we are now returning boundary commits.
+ * create_boundary_commit_list() has populated
+ * revs->commits with the remaining commits to return.
+ */
+ c = pop_commit(&revs->commits);
+ if (c)
+ c->object.flags |= SHOWN;
return c;
}
* switch to boundary commits output mode.
*/
revs->boundary = 2;
+
+ /*
+ * Update revs->commits to contain the list of
+ * boundary commits.
+ */
+ create_boundary_commit_list(revs);
+
return get_revision_internal(revs);
}