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

Re: [PATCH/RFC 2/2] Make path-limiting be incremental when possible.

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 2, 2006, 00:35 UTC
Message-ID
<Pine.LNX.4.64.0604011628500.3684@g5.osdl.org>
In-Reply-To
<7vr74jw0zj.fsf@assigned-by-dhcp.cox.net>
On Thu, 30 Mar 2006, Junio C Hamano wrote:
Show 6 quoted lines
> 
> OK, so let's say I agree with you that --unpacked and --since
> are "stop early" rules.  I fully agree with that from usability
> and implementation point of view, but I now wonder if the
> "output filter" in get_revision() and "stop early" in limit_list()
> would do the same thing.
They don't.

What ends up not working very well at all is the combination of "--topo-order" and the output filter in get_revision. It will return NULL when we see the first commit out of date-order, even if we have other commits coming.

So we really should do the "past the date order" thing in get_revision() only if we have _not_ done it already in limit_list().

Something like this.
The easiest way to test this is with just
	gitk --since=3.days.ago

on the kernel tree. Without this patch, it tends to be pretty obviously broken.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
		Linus
---
diff --git a/revision.c b/revision.c
index a8a54b6..558ed01 100644
--- a/revision.c
+++ b/revision.c
@@ -783,10 +783,14 @@ struct commit *get_revision(struct rev_i
 
 		/*
 		 * If we haven't done the list limiting, we need to look at
-		 * the parents here
+		 * the parents here. We also need to do the date-based limiting
+		 * that we'd otherwise have done in limit_list().
 		 */
-		if (!revs->limited)
+		if (!revs->limited) {
+			if (revs->max_age != -1 && (commit->date < revs->max_age))
+				continue;
 			add_parents_to_list(revs, commit, &revs->commits);
+		}
 		if (commit->object.flags & SHOWN)
 			continue;
 		if (!(commit->object.flags & BOUNDARY) &&
@@ -794,8 +798,6 @@ struct commit *get_revision(struct rev_i
 			continue;
 		if (revs->min_age != -1 && (commit->date > revs->min_age))
 			continue;
-		if (revs->max_age != -1 && (commit->date < revs->max_age))
-			return NULL;
 		if (revs->no_merges &&
 		    commit->parents && commit->parents->next)
 			continue;
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 17 in “Move "--parent" parsing into generic revision.c library code”
  1. 1/2 Move "--parent" parsing into generic revision.c library codeLinus Torvalds, Mar 31, 2006
  2. 2/2 Make path-limiting be incremental when possible.Linus Torvalds, Mar 31, 2006
  3. Linus TorvaldsMar 31, 2006
  4. Junio C HamanoMar 31, 2006
  5. Linus TorvaldsMar 31, 2006
  6. Junio C HamanoMar 31, 2006
  7. Linus TorvaldsMar 31, 2006
  8. Junio C HamanoMar 31, 2006
  9. Linus TorvaldsMar 31, 2006
  10. Junio C HamanoMar 31, 2006
  11. Linus TorvaldsApr 2, 2006
  12. Junio C HamanoApr 2, 2006
  13. revision: simplify argument parsing.Junio C Hamano, Apr 2, 2006
  14. revision: --max-age alone does not need limit_list() anymore.Junio C Hamano, Apr 2, 2006
  15. Junio C HamanoMar 31, 2006
  16. Linus TorvaldsMar 31, 2006
  17. Junio C HamanoApr 3, 2006

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.