summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ce567d1)
raw | patch | inline | side by side (parent: ce567d1)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Wed, 23 Jul 2008 00:51:36 +0000 (01:51 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 23 Jul 2008 19:00:21 +0000 (12:00 -0700) |
We used to set the TOPOSORT flag of commits during the topological
sorting, but we can just as well use the member "indegree" for it:
indegree is now incremented by 1 in the cases where the commit used
to have the TOPOSORT flag.
This is the same behavior as before, since indegree could not be
non-zero when TOPOSORT was unset.
Incidentally, this fixes the bug in show-branch where the 8th column
was not shown: show-branch sorts the commits in topological order,
assuming that all the commit flags are available for show-branch's
private matters.
But this was not true: TOPOSORT was identical to the flag corresponding
to the 8th ref. So the flags for the 8th column were unset by the
topological sorting.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sorting, but we can just as well use the member "indegree" for it:
indegree is now incremented by 1 in the cases where the commit used
to have the TOPOSORT flag.
This is the same behavior as before, since indegree could not be
non-zero when TOPOSORT was unset.
Incidentally, this fixes the bug in show-branch where the 8th column
was not shown: show-branch sorts the commits in topological order,
assuming that all the commit flags are available for show-branch's
private matters.
But this was not true: TOPOSORT was identical to the flag corresponding
to the 8th ref. So the flags for the 8th column were unset by the
topological sorting.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c | patch | blob | history | |
revision.h | patch | blob | history | |
t/t3202-show-branch-octopus.sh | patch | blob | history |
diff --git a/commit.c b/commit.c
index 5148ec552708bb6c98cc64a84647ec7715ad1c29..dc0c5bfdab7296bf7febb6f1b1aad64550838c15 100644 (file)
--- a/commit.c
+++ b/commit.c
/* Mark them and clear the indegree */
for (next = orig; next; next = next->next) {
struct commit *commit = next->item;
- commit->object.flags |= TOPOSORT;
- commit->indegree = 0;
+ commit->indegree = 1;
}
/* update the indegree */
while (parents) {
struct commit *parent = parents->item;
- if (parent->object.flags & TOPOSORT)
+ if (parent->indegree)
parent->indegree++;
parents = parents->next;
}
for (next = orig; next; next = next->next) {
struct commit *commit = next->item;
- if (!commit->indegree)
+ if (commit->indegree == 1)
insert = &commit_list_insert(commit, insert)->next;
}
for (parents = commit->parents; parents ; parents = parents->next) {
struct commit *parent=parents->item;
- if (!(parent->object.flags & TOPOSORT))
+ if (!parent->indegree)
continue;
/*
* when all their children have been emitted thereby
* guaranteeing topological order.
*/
- if (!--parent->indegree) {
+ if (--parent->indegree == 1) {
if (!lifo)
insert_by_date(parent, &work);
else
* work_item is a commit all of whose children
* have already been emitted. we can emit it now.
*/
- commit->object.flags &= ~TOPOSORT;
+ commit->indegree = 0;
*pptr = work_item;
pptr = &work_item->next;
}
diff --git a/revision.h b/revision.h
index fa68c651424e406ce84c890a655a5e292a7e5af6..f64e8ce7ff999e9fe4a01205ae51775827484ed4 100644 (file)
--- a/revision.h
+++ b/revision.h
#define CHILD_SHOWN (1u<<6)
#define ADDED (1u<<7) /* Parents already parsed and added? */
#define SYMMETRIC_LEFT (1u<<8)
-#define TOPOSORT (1u<<9) /* In the active toposort list.. */
-#define ALL_REV_FLAGS ((1u<<10)-1)
+#define ALL_REV_FLAGS ((1u<<9)-1)
struct rev_info;
struct log_info;
index 8d50c23b84dad390a66edc1c3e80007ef43fa3a3..7fe4a6ecb05df0fbfb825fbb08207f7672e1775f 100755 (executable)
+++++++++* [branch10^] initial
EOF
-test_expect_failure 'show-branch with more than 8 branches' '
+test_expect_success 'show-branch with more than 8 branches' '
git show-branch $(for i in $numbers; do echo branch$i; done) > out &&
test_cmp expect out