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

[PATCH 2/6] merge_base(): move traversal into a separate function.

From
Junio C Hamano <junkio@cox.net>
Date
Jan 9, 2007, 10:41 UTC
Message-ID
<7vtzz0o52g.fsf@assigned-by-dhcp.cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 commit.c |   38 ++++++++++++++++++++++----------------
 1 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/commit.c b/commit.c
index aa14c5a..53f43e3 100644
--- a/commit.c
+++ b/commit.c
@@ -1034,25 +1034,10 @@ static struct commit *interesting(struct commit_list *list)
 	return NULL;
 }
 
-static struct commit_list *merge_bases(struct commit *one, struct commit *two)
+static struct commit_list *base_traverse(struct commit_list *list)
 {
-	struct commit_list *list = NULL;
 	struct commit_list *result = NULL;
 
-	if (one == two)
-		/* We do not mark this even with RESULT so we do not
-		 * have to clean it up.
-		 */
-		return commit_list_insert(one, &result);
-
-	parse_commit(one);
-	parse_commit(two);
-
-	one->object.flags |= PARENT1;
-	two->object.flags |= PARENT2;
-	insert_by_date(one, &list);
-	insert_by_date(two, &list);
-
 	while (interesting(list)) {
 		struct commit *commit;
 		struct commit_list *parents;
@@ -1098,6 +1083,27 @@ static struct commit_list *merge_bases(struct commit *one, struct commit *two)
 	return result;
 }
 
+static struct commit_list *merge_bases(struct commit *one, struct commit *two)
+{
+	struct commit_list *list = NULL;
+
+	if (one == two)
+		/* We do not mark this even with RESULT so we do not
+		 * have to clean it up.
+		 */
+		return commit_list_insert(one, &list);
+
+	parse_commit(one);
+	parse_commit(two);
+
+	one->object.flags |= PARENT1;
+	two->object.flags |= PARENT2;
+	insert_by_date(one, &list);
+	insert_by_date(two, &list);
+
+	return base_traverse(list);
+}
+
 struct commit_list *get_merge_bases(struct commit *one,
 				    struct commit *two,
                                     int cleanup)
-- 
1.4.4.4.g564d
Message 1 of 1 in “merge_base(): move traversal into a separate function.”
  1. 2/6 merge_base(): move traversal into a separate function.Junio C Hamano, Jan 9, 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.