Subject: Re: [PATCH] revision.c: Remove unneeded check for NULL

From: Jonathan Nieder <[email-masked]>
Date: Tue, 30 Jun 2015 15:48:14 -0700

Jeff King wrote:
> On Fri, Jun 26, 2015 at 12:40:19PM -0700, Stefan Beller wrote:

>>> This code seems to be underdocumented.
>>
>> I am not a expert in this area of the code, so I hoped Peff
>> would document it if he feels like so.
>
> I kind of thought that the explanation in b6e8a3b covered this code.
> Does it not, or did people not read it?

I know that "tl;dr" is the last thing anyone who has written a clear
description of something wants to read, but I fear it applies here.  I
tried to skim that commit message to get a gist of what the
still_interesting variable is supposed to hold and I failed.

I think part of the problem was that that commit message doesn't give
a specific example early on to motivate the problem and fix[*].

More to the point, someone interested in that specific variable
doesn't need to necessarily understand the optimization that motivated
it.  Instead, they'd want to know what invariants to expect and
preserve: what value does it start with, what does its value mean, are
there some forbidden values, etc.

Is the idea that it represents a commit from the queue which is still
interesting, and that it saves us from looping through the queue to
find a still-interesting commit as long as mark_parents_uninteresting
has not marked this one uninteresting yet?  What does it mean when it
is NULL?

Thanks,
Jonathan

[*] I.e., what command do I run to get quadratic behavior?

The message starts with a diagnosis --- "When we are limiting a
rev-list traversal due to UNINTERESTING refs, we have to walk down the
tips" --- without introducing what problem is being diganosed.

The problem being solved might have been something like "When we call
'git rev-list $commits --not --all' in check_everything_connected
after a fetch, if we fetched something much older than most of our
refs, and if we have a large number of refs, the operation is slow ---
quadratic in the number of refs.  This hasn't been a problem in the
past because people did not use so many refs, but now as the number of
refs in a typical repository grows, it is becoming more noticeable."
Even after re-reading the message more carefully, I'm not sure.  I
assume there was a report motivating the change, which might have been
useful for putting the explanation in context for the reader.
Alas, git://repo.or.cz/git/trast.git branch notes/gmane doesn't have any
annotations for that commit to find the context.

The commit message then goes on to explain how the patch solves that
problem, but without an example to put that explanation in context, it
is hard to follow.  What linear search is the explanation talking
about?  What is the interesting commit we find?  I couldn't tell without
looking at the code.