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

Re: [PATCH] graph: avoid infinite loop in graph_show_commit()

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 25, 2012, 18:11 UTC
Message-ID
<7v6272vupm.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vtxunvvr4.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> Has either of you tried the patch with the problematic case the
> other patch tries to solve?  Michal's old patch does smell like it
> is going in the better direction in that it stops looping when we
> know we would only be showing the padding, which is a sign that we
> are done with showing the commit.

I think this should suffice. I do not know if Michal's patch is the right fix, though. It appears to me that "--graph" assumes one commit is shown only once, but "diff-tree -m" and friends want to show a merge commit twice and is fundamentally incompatible with the assumption. We might be off either fixing that in the "graph" code (not with a band-aid like patches from you two to make it punt), or forbidding the combination altogether.

 t/t4202-log.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 71be59d..14f73e3 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -264,6 +264,16 @@ test_expect_success 'log --graph with merge' '
 	test_cmp expect actual
 '
 
+test_expect_success 'log --raw --graph -m with merge' '
+	git log --raw --graph --oneline -m master | head -n 500 >actual &&
+	grep "initial" actual
+'
+
+test_expect_success 'diff-tree --graph' '
+	git diff-tree --graph master^ | head -n 500 >actual &&
+	grep "one" actual
+'
+
 cat > expect <<\EOF
 *   commit master
 |\  Merge: A B
-- 
1.7.12.1.451.gb433296
Previous: Junio C Hamano
Message 5 of 5 in “graph: avoid infinite loop in graph_show_commit()”
  1. graph: avoid infinite loop in graph_show_commit()Nguyễn Thái Ngọc Duy, Sep 22, 2012
  2. Michal KiedrowiczSep 23, 2012
  3. Nguyen Thai Ngoc DuySep 23, 2012
  4. Junio C HamanoSep 24, 2012
  5. Junio C HamanoSep 25, 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.