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

Re: [RFH] revision limiting sometimes ignored

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 6, 2008, 06:05 UTC
Message-ID
<7vhcgm4o1p.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7v7ihi7syj.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
> As Linus earlier said, the question really is: for positive
> commits in "newlist", have we not missed any its UNINTERESTING
> descendants?
>
> For a toy-scale graph, a parallel merge-base traversal like what
> show-branch does may work, but for a real workload, newlist
> would contain literally hundreds of commits, so using unaltered
> "merge-base" algorithm is probably not an option either.

After exiting the while (list) we need to prove that each positive commit in "newlist" cannot be reached by any of the negative commit still in "list".

Even though "newlist" may have thousands of commits, we do not have to inspect all of them. In order to prove that we traversed everything that matters, we will only need to look at the ones whose ancestors are not in "newlist" (bottom commits) and see if each of them can be reached from the negative ones. If a non-bottom commit is reachable from one of the negative ones, then the bottom commit that is ancestor of that non-bottom commit surely is reachable as well.

We can make one pass to mark everything on "newlist" with one bit from flags, and then another pass to mark the positive ones whose parent has that bit set, so we would need two bits in total while finding out the set of bottom commits (we can reuse these two bits after we know what they are).

Once we find the set of bottom commits in "newlist", we would need to prove that none of them can be reached from any of the negative commits still in "list". We can do this traversal using two bits from flags, exactly like commit.c::merge_bases()

    for each bottom commit B {
	L = empty list
	B.flags |= PARENT2
	L.append(B)
	for each negative commit C in "list from limit_list()"
            C.flags |= PARENT1
            L.append(C)
	while (L) {
	    C = shift L;
	    flag = C.flags & (PARENT1|PARENT2);
            if (flag ==  (PARENT1|PARENT2))
 		continue; /* common */
	    for each parent P of commit C:
		pflag = P.flags & (PARENT1|PARENT2);
		if (pflag == flag)
                    continue;
		P.flags |= flags;
                L.append(P)
	}
        if (B.flags & PARENT1)
            we still need to traverse -- everybody_uninteresting()
	    in limit_list() main loop was not enough!
    }
Previous: Junio C HamanoNext: Junio C Hamano
Message 28 of 34 in “[BUG?] git log picks up bad commit”
  1. Tilman SauerbeckFeb 2, 2008
  2. Jeff KingFeb 3, 2008
  3. [RFH] revision limiting sometimes ignoredJeff King, Feb 3, 2008
  4. Junio C HamanoFeb 3, 2008
  5. Junio C HamanoFeb 3, 2008
  6. Jeff KingFeb 3, 2008
  7. Jeff KingFeb 3, 2008
  8. Junio C HamanoFeb 3, 2008
  9. Junio C HamanoFeb 3, 2008
  10. Junio C HamanoFeb 3, 2008
  11. Linus TorvaldsFeb 4, 2008
  12. Linus TorvaldsFeb 4, 2008
  13. Junio C HamanoFeb 4, 2008
  14. Linus TorvaldsFeb 4, 2008
  15. Linus TorvaldsFeb 4, 2008
  16. Linus TorvaldsFeb 4, 2008
  17. Junio C HamanoFeb 5, 2008
  18. Linus TorvaldsFeb 5, 2008
  19. Johannes SchindelinFeb 5, 2008
  20. Linus TorvaldsFeb 5, 2008
  21. Tilman SauerbeckFeb 6, 2008
  22. Nicolas PitreFeb 6, 2008
  23. Linus TorvaldsFeb 6, 2008
  24. Nicolas PitreFeb 6, 2008
  25. Linus TorvaldsFeb 6, 2008
  26. Nicolas PitreFeb 6, 2008
  27. Junio C HamanoFeb 6, 2008
  28. Junio C HamanoFeb 6, 2008
  29. Junio C HamanoFeb 6, 2008
  30. Junio C HamanoFeb 5, 2008
  31. Linus TorvaldsFeb 6, 2008
  32. Junio C HamanoFeb 6, 2008
  33. Karl HasselströmFeb 6, 2008
  34. Linus TorvaldsFeb 6, 2008

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.