git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 0/4] Add --no-ahead-behind to status

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 9, 2018, 13:15 UTC
Message-ID
<nycvar.QRO.7.76.6.1801091407480.37@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
In-Reply-To
<20180109072044.GD32257@sigill.intra.peff.net>
Hi Peff,
On Tue, 9 Jan 2018, Jeff King wrote:
Show 19 quoted lines
> On Mon, Jan 08, 2018 at 03:04:20PM -0500, Jeff Hostetler wrote:
> 
> > > I was thinking about something similar to the logic we use today
> > > about whether to start reporting progress on other long commands.
> > > That would mean you could still get the ahead/behind values if you
> > > aren't that far behind but would only get "different" if that
> > > calculation gets too expensive (which implies the actual value isn't
> > > going to be all that helpful anyway).
> > 
> > After a off-line conversation with the others I'm going to look into
> > a version that is limited to n commits rather than be completely on or
> > off.  I think if you are for example less than 100 a/b then those numbers
> > have value; if you are past n, then they have much less value.
> > 
> > I'd rather do it by a fixed limit than by time to ensure that output
> > is predictable on graph shape and not on system load.
> 
> I like this direction a lot. I had hoped we could say "100+ commits
> ahead",
How about "100+ commits apart" instead?
> but I don't think we can do so accurately without generation numbers.

Even with generation numbers, it is not possible to say whether two given commits reflect diverging branches or have an ancestor-descendant relationship (or in graph speak: whether they are comparable).

It could potentially make it possible to cut off the commit traversal, but I do not even see how that would be possible.

The only thing you could say for sure is that two different commits with the same generation number are for sure "uncomparable", i.e. reflect diverging branches.

Show 6 quoted lines
> E.g., the case I mentioned at the bottom of this mail:
> 
>   https://public-inbox.org/git/20171224143318.GC23648@sigill.intra.peff.net/
> 
> I haven't thought too hard on it, but I suspect with generation numbers
> you could bound it and at least say "100+ ahead" or "100+ behind".

If you have walked 100 commits and still have not found a merge base, there is no telling whether one start point is the ancestor of the other. All you can say is that there are more than 100 commits in the "difference".

You would not even be able to say that the *shortest* path between those two start points is longer than 100 commits, you can construct pathological DAGs pretty easily.

Even if you had generation numbers, and one commit's generation number was, say, 17, and the other one's was 17,171, you could not necessarily assume that the 17 one is the ancestor of the 17,171 one, all you can say that it is not possible the other way round.

Show 6 quoted lines
> But I don't think you can approximate both ahead and behind together
> without finding the actual merge base.
> 
> But even still, finding small answers quickly and accurately and punting
> to "really far, I didn't bother to compute it" on the big ones would be
> an improvement over always punting.

Indeed. The longer I think about it, the more I like the "100+ commits apart" idea.

Ciao, Dscho

Previous: Jeff KingNext: Derrick Stolee
Message 9 of 16 in “Add --no-ahead-behind to status”
  1. 0/4 Add --no-ahead-behind to statusJeff Hostetler, Jan 8, 2018
  2. 1/4 stat_tracking_info: return +1 when branches not equalJeff Hostetler, Jan 8, 2018
  3. 2/4 status: add --[no-]ahead-behind to status and commit for V2 format.Jeff Hostetler, Jan 8, 2018
  4. 3/4 status: update short status to respect --no-ahead-behindJeff Hostetler, Jan 8, 2018
  5. 4/4 status: support --no-ahead-behind in long formatJeff Hostetler, Jan 8, 2018
  6. Ben PeartJan 8, 2018
  7. Jeff HostetlerJan 8, 2018
  8. Jeff KingJan 9, 2018
  9. Johannes SchindelinJan 9, 2018
  10. Derrick StoleeJan 9, 2018
  11. Jeff HostetlerJan 9, 2018
  12. Johannes SchindelinJan 9, 2018
  13. Jeff KingJan 10, 2018
  14. Junio C HamanoJan 10, 2018
  15. Jeff KingJan 11, 2018
  16. Jeff KingJan 10, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.