Re: What's in git.git
- From
Junio C Hamano <junkio@cox.net>
- Date
- Mar 5, 2006, 05:44 UTC
- Message-ID
- <7vfylxigxc.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.64.0603042058250.13139@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> I'm not sure this is worth it, but it looks obvious enough. Somebody with > gitweb somewhere should probably check if it still even wants this.
I just pulled and it's still v264 (Jan 17 2006). It does it in one sub (git_read_commit) to read a single commit and the sub is called from almost everywhere, so it would help.
Having said that...
Show 20 quoted lines
> diff --git a/revision.c b/revision.c
> index a3df810..33a5f20 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -696,6 +696,18 @@ struct commit *get_revision(struct rev_i
> break;
> case 0:
> return NULL;
> +
> + /* Special case to avoid unnecessary parent checking */
> + case 1:
> + if (!revs->limited &&
> + !revs->no_merges &&
> + !revs->paths &&
> + revs->min_age == -1 &&
> + revs->max_age == -1) {
> + revs->max_count = 0;
> + commit->object.flags |= SHOWN;
> + return commit;
> + }At this point commit is revs->commits->item. It cannot be UNINTERESTING because you make it sure with !revs->limited and friends, but I wonder if it can be SHOWN already for some reason, in which case returning it is wrong.
Unlike the earlier special case in rev-list, this special case kicks in for the last iteration of repeated calls to get_revision() (e.g. third iteration of "rev-list -3")...