Re: [PATCH 3/2] Enhance --early-output format
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Nov 5, 2007, 21:35 UTC
- Message-ID
- <alpine.LFD.0.999.0711051328140.15101@woody.linux-foundation.org>
- In-Reply-To
- <alpine.LFD.0.999.0711051313350.15101@woody.linux-foundation.org>
On Mon, 5 Nov 2007, Linus Torvalds wrote:
Show 5 quoted lines
>
> Here's a possible cleanup patch. It's on top of the enhanced
> --early-output format commit, and in fact fixes a stupid bug in that
> commit ("return -1" vs "return NULL"), but that bug-fix is really an
> independent thing... and this extends a bit further on the notion.
It basically means that "rev->dense" can now be ignored outside of revision.c, because we'll just set TREECHANGE automatically when seeing a non-merge regular commit when --sparse is being used.
So it's not just a simplification, it's a performance optimization too!
Although since nobody sane would ever use --sparse, I guess nobody really cares.
Linus
--- builtin-log.c | 8 ++------ revision.c | 9 +++++++++ 2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c index 76c84e2..d6845bc 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -88,13 +88,9 @@ static int estimate_commit_count(struct rev_info *rev, struct commit_list *list) while (list) { struct commit *commit = list->item; unsigned int flags = commit->object.flags; - list = list->next; - if (flags & UNINTERESTING) - continue; - if (!(flags & TREECHANGE) && rev->dense && single_parent(commit)) - continue; - n++; + if ((flags & TREECHANGE) && !(flags & UNINTERESTING)) + n++; } return n; } diff --git a/revision.c b/revision.c index 7a1ecba..02e9241 100644 --- a/revision.c +++ b/revision.c @@ -325,6 +325,15 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) return; } + /* + * Normal non-merge commit? If we don't want to make the + * history dense, we consider it always to be a change.. + */ + if (!revs->dense && !commit->parents->next) { + commit->object.flags |= TREECHANGE; + return; + } + pp = &commit->parents; while ((parent = *pp) != NULL) { struct commit *p = parent->item;