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

[PATCH 3/3] revision: cull side parents before running simplify-merges

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 8, 2012, 22:53 UTC
Message-ID
<1339196009-14555-4-git-send-email-gitster@pobox.com>
In-Reply-To
<1339196009-14555-1-git-send-email-gitster@pobox.com>

The simplify_merges() function needs to look at all history chain to find the closest ancestor that is relevant after the simplification, but after --first-parent traversal, side parents haven't been marked for relevance (they are irrelevant by definition due to the nature of first-parent-only traversal) nor culled from the parents list of resulting commits.

Remove these side parents from parents list before starting to further simplifying the result.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 revision.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/revision.c b/revision.c
index 814b96f..d93eb7c 100644
--- a/revision.c
+++ b/revision.c
@@ -2031,6 +2031,9 @@ static void simplify_merges(struct rev_info *revs)
 		 * Do not free(list) here yet; the original list
 		 * is used later in this function.
 		 */
+		if (revs->first_parent_only &&
+		    commit->parents && commit->parents->next)
+			commit->parents->next = NULL;
 		commit_list_insert(commit, &yet_to_do);
 	}
 	while (yet_to_do) {
-- 
1.7.11.rc2.29.g85b30f3
Previous: Junio C Hamano
Message 4 of 4 in “rev-list --simplify-{merges,by-decoration} --first-parent”
  1. 0/3 rev-list --simplify-{merges,by-decoration} --first-parentJunio C Hamano, Jun 8, 2012
  2. 1/3 revision: "simplify" options imply topo-order sortJunio C Hamano, Jun 8, 2012
  3. 2/3 revision: note the lack of free() in simplify_merges()Junio C Hamano, Jun 8, 2012
  4. 3/3 revision: cull side parents before running simplify-mergesJunio C Hamano, Jun 8, 2012

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.