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

Re: [PATCH v2 1/2] graph: fix case that hit assert()

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 7, 2020, 21:50 UTC
Message-ID
<xmqqd0bv3pin.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<c05fe2c37a87b254157eec1c8a0f8ca206e1cd31.1578432422.git.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 22 quoted lines
> From: Derrick Stolee <dstolee@microsoft.com>
> Subject: Re: [PATCH v2 1/2] graph: fix case that hit assert()
>
> A failure was reported in "git log --graph --all" with the new
> graph-rendering logic. The code fails an assert() statement when
> collapsing multiple edges from a merge.
>
> The assert was introduced by eaf158f8 (graph API: Use horizontal
> lines for more compact graphs, 2009-04-21), which is quite old.
> This assert is trying to say that when we complete a horizontal
> line with a single slash, it is because we have reached our target.
>
> This assertion is hit when we have two collapsing lines from the
> same merge commit, as follows:
>
>     | | | | *
>     | |_|_|/|
>     |/| | |/
>     | | |/|
>     | |/| |
>     | * | |
>     * | | |
I was sort-of expecting to see
    graph: drop assert() for merge with two collapsing parents
    When "git log --graph" shows a merge commit that has two collapsing
    lines, like:
        | | | | *
        | |_|_|/|
        |/| | |/
        | | |/|
        | |/| |
        | * | |
        * | | |
    we trigger an assert():
            graph.c:1228: graph_output_collapsing_line: Assertion
                          `graph->mapping[i - 3] == target' failed.
    The assert was introduced by eaf158f8 ("graph API: Use horizontal
    lines for more compact graphs", 2009-04-21), which is quite old.
    ...
near the beginning of this commit, though.
Show 27 quoted lines
> In a larger example, the current code will output a collapse
> as follows:
>
> 	| | | | | | *
> 	| |_|_|_|_|/|\
> 	|/| | | | |/ /
> 	| | | | |/| /
> 	| | | |/| |/
> 	| | |/| |/|
> 	| |/| |/| |
> 	| | |/| | |
> 	| | * | | |
>
> However, the intended collapse should allow multiple horizontal lines
> as follows:
>
> 	| | | | | | *
> 	| |_|_|_|_|/|\
> 	|/| | | | |/ /
> 	| | |_|_|/| /
> 	| |/| | | |/
> 	| | | |_|/|
> 	| | |/| | |
> 	| | * | | |
>
> This behavior is not corrected by this change, but is noted for a later
> update.
This part is new and looks like a good thing to mention.
Previous: Derrick Stolee via GitGitGadgetNext: Junio C Hamano
Message 20 of 24 in “Fix two bugs in graph.c”
  1. 0/3 Fix two bugs in graph.cDerrick Stolee via GitGitGadget, Jan 7, 2020
  2. 2/3 graph: replace assert() with graph_assert() macroDerrick Stolee via GitGitGadget, Jan 7, 2020
  3. Jeff KingJan 7, 2020
  4. Eric SunshineJan 7, 2020
  5. Derrick StoleeJan 7, 2020
  6. 1/3 graph: fix case that hit assert()Derrick Stolee via GitGitGadget, Jan 7, 2020
  7. Jeff KingJan 7, 2020
  8. Derrick StoleeJan 7, 2020
  9. Junio C HamanoJan 7, 2020
  10. Jeff KingJan 7, 2020
  11. Junio C HamanoJan 7, 2020
  12. 3/3 t4215: add bigger graph collapse testDerrick Stolee via GitGitGadget, Jan 7, 2020
  13. Jeff KingJan 7, 2020
  14. Junio C HamanoJan 7, 2020
  15. Jeff KingJan 7, 2020
  16. Derrick StoleeJan 7, 2020
  17. Junio C HamanoJan 7, 2020
  18. 0/2 Fix two bugs in graph.cDerrick Stolee via GitGitGadget, Jan 7, 2020
  19. 1/2 graph: fix case that hit assert()Derrick Stolee via GitGitGadget, Jan 7, 2020
  20. Junio C HamanoJan 7, 2020
  21. Junio C HamanoJan 8, 2020
  22. Derrick StoleeJan 8, 2020
  23. 2/2 graph: fix lack of color in horizontal linesDerrick Stolee via GitGitGadget, Jan 7, 2020
  24. Junio C HamanoJan 7, 2020

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.