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

[RFC] revision.c: traverse to many revisions to find boundary

From
lidongyan <502024330056@smail.nju.edu.cn>
Date
May 28, 2025, 16:36 UTC
Message-ID
<3378F2BB-B2FB-4E07-9C02-A57D43D1A89C@smail.nju.edu.cn>
In revisions.c:get_revision_internal(), when the caller wants to
retrieve all boundary commits, this function identifies the parents
of the last commits emitted by get_revision_1() as boundary commits.
However, if get_revision_1() encounters an UNINTERESTING commit,
it continues to recursively traverse the parents of that commit. 
But only the earliest UNINTERESTING commits are eventually marked
 as boundary.

This raises the question: when revs->boundary is true, do we really need to continue traversing after encountering an UNINTERESTING commit? Perhaps we could optimize this by stopping the traversal earlier—for example, by doing something like this:

diff --git a/revision.c b/revision.c
index 2c36a9c179..0d99c22913 100644
--- a/revision.c
+++ b/revision.c
@@ -1176,6 +1176,8 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
 			if (p->object.flags & SEEN)
 				continue;
 			p->object.flags |= (SEEN | NOT_USER_GIVEN);
+			if (revs->boundary)
+				break;
 			if (list)
 				commit_list_insert_by_date(p, list);
 			if (queue)
Message 1 of 1 in “[RFC] revision.c: traverse to many revisions to find boundary”
  1. lidongyanMay 28, 2025

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.