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

Re: [PATCH] revision walker: Fix --boundary when limited

From
Junio C Hamano <junkio@cox.net>
Date
Mar 6, 2007, 01:32 UTC
Message-ID
<7vd53nupg9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0703060137210.22628@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 9 quoted lines
>> +	if (revs->reverse) {
>> +		l = NULL;
>> +		while ((c = get_revision_1(revs)))
>> +			commit_list_insert(c, &l);
>> +		revs->commits = l;
>> +		revs->reverse = 0;
>>  	}
>
> Clever!

It is not clever, but just is stupid and WRONG. It just shows how little I care about --reverse ;-).

revision_1() is to get the full list without non limit limiters, so the above loop would not even deplete the max_count but literally grabs everything.

Arguably, you can do "rev-list --reverse -2 master" to get the first two commits with this, but it was not intended. We would need to grab (skip + max_count) from get_revision_1() and set max_count to -1 before leaving the if () {} here, or something like that.

Show 9 quoted lines
> I guess that you want to do this instead:
>
> 	case 0:
> 		c = NULL;
> 		/* fall through */
>>  	default:
>>  		revs->max_count--;
>
> ...

Actually that is not correct either. The other patch fixes it (but not the unintended semantic change to --reverse).

>> +	for (l = c->parents; l; l = l->next) {
>
> AFAICT this changes behaviour: c->parents were possibly rewritten.

Well, the behaviour of max with boundary in 'master' did the same thing, as what was in revs->commits are rewritten parents of commits we already returned, didn't it?

Show 10 quoted lines
> But I 
> guess it makes sense showing the rewritten parents as boundary commits, 
> not the real parents.
>
>> +		struct object *p;
>> +		p = &(l->item->object);
>> +		if (p->flags & CHILD_SHOWN)
>
> ... or
> 		if (p->flags & (CHILD_SHOWN | SHOWN))

"If itself is shown it cannot be a boundary, and if we know we marked it as potential boundary we do not have to mark it again"... I think you are right.

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 11 of 26 in “[BUG] git-rev-list: --topo-order --boundary and --max-count”
  1. Santi BéjarMar 5, 2007
  2. Junio C HamanoMar 5, 2007
  3. Junio C HamanoMar 5, 2007
  4. Linus TorvaldsMar 5, 2007
  5. revision walker: Fix --boundary when limitedJohannes Schindelin, Mar 5, 2007
  6. Johannes SchindelinMar 5, 2007
  7. Linus TorvaldsMar 5, 2007
  8. Linus TorvaldsMar 5, 2007
  9. Junio C HamanoMar 5, 2007
  10. Johannes SchindelinMar 6, 2007
  11. Junio C HamanoMar 6, 2007
  12. Johannes SchindelinMar 6, 2007
  13. Junio C HamanoMar 6, 2007
  14. Johannes SchindelinMar 5, 2007
  15. Junio C HamanoMar 6, 2007
  16. 2/4 revision traversal: retire BOUNDARY_SHOWJunio C Hamano, Mar 6, 2007
  17. Johannes SchindelinMar 6, 2007
  18. Junio C HamanoMar 6, 2007
  19. SHOWN means shownJunio C Hamano, Mar 6, 2007
  20. Johannes SchindelinMar 6, 2007
  21. Junio C HamanoMar 6, 2007
  22. Johannes SchindelinMar 6, 2007
  23. 3/4 git-bundle: various fixupsJunio C Hamano, Mar 6, 2007
  24. Johannes SchindelinMar 6, 2007
  25. 4/4 git-bundle: --list-prereqsJunio C Hamano, Mar 6, 2007
  26. Junio C HamanoMar 5, 2007

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.