Re: [RFH] revision limiting sometimes ignored
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:44:10
Subsystem:
the rest · Maintainer:
Linus Torvalds
On Mon, 4 Feb 2008, Linus Torvalds wrote:
This patch is untested and obviously won't even compile (I didn't actually add the "hit_root" bitfield to the revision struct), but shows what I *think* should fix this issue, without the performance problem.
Ok, so I was lazy. Here's the updated patch that actually compiles and is also now verified to fix Junio's test-case. (Same patch, just the added bitfield declaration, and the testing ;) Linus --- revision.c | 5 ++++- revision.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/revision.c b/revision.c
index 6e85aaa..0e90988 100644
--- a/revision.c
+++ b/revision.c@@ -456,6 +456,9 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str left_flag = (commit->object.flags & SYMMETRIC_LEFT); + if (!commit->parents) + revs->hit_root = 1; + rest = !revs->first_parent_only; for (parent = commit->parents, add = 1; parent; add = rest) { struct commit *p = parent->item;
@@ -579,7 +582,7 @@ static int limit_list(struct rev_info *revs) return -1; if (obj->flags & UNINTERESTING) { mark_parents_uninteresting(commit); - if (everybody_uninteresting(list)) + if (!revs->hit_root && everybody_uninteresting(list)) break; continue; }
diff --git a/revision.h b/revision.h
index 8572315..5188a2f 100644
--- a/revision.h
+++ b/revision.h@@ -48,7 +48,8 @@ struct rev_info { parents:1, reverse:1, cherry_pick:1, - first_parent_only:1; + first_parent_only:1, + hit_root:1; /* Diff flags */ unsigned int diff:1,