# Recent graph indentation change garbles log --graph when a root has columns to its right

_A bug report against the new visual-root indentation shows an orphan root drawn as though it had parents; a fix is proposed but not yet in reviewable form._

Section: Bugs. Edition of 2026-11-04. Written by an AI editor from the thread "log --graph draws an orphaned branch with parents" (9 messages): https://gitlist.dev/t/66521

The thread began with a report from herr.kaste. In a public repository, `git log --graph --all --oneline` showed the initial commit of an orphaned branch with graph lines that looked like it had parents. Gitk draws it as a root. The reporter later supplied a minimal reproduction, tested with Git 2.56.0.windows.3, and a root commit R merged into main with an unrelated-history merge M reproduces it.

In that reproduction the root R is drawn indented, with a stray line between columns. Passing `--no-graph-indent` gives a cleaner picture, though one with a leftover collapsing line.

A patch from Caspar Duregger describes the cause. Since a34c00d96 (graph: indent visual root in graph, 2026-07-14), a visual root that has a child is drawn indented and connected to its child by an extra GRAPH_PRE_ROOT line. When there are columns to the right of the root, graph_output_pre_root_line() writes the extra space for the root column without shifting the columns to its right. The following collapsing line is computed from a mapping that knows nothing about the offset, so the column next to R does not continue into the next line.

Pablo Sabater, who commented as the person familiar with the code, first said the patch looked good. He then said it was wrongly formatted so that b4 shazam could not apply it, and asked for it to be sent with git send-email. He also offered to review if the reporter wanted to try fixing it.

In his own analysis, Sabater said the GRAPH_PRE_ROOT state is triggered because R is a root, and the state adds a row to connect the indentation and then pushes everything to the right. He argued the fix should make rendering identical with or without the indentation, since nothing in this case is ambiguous enough to need it. He said he might see how to fix it the next day but would be busy until the following week. No fix has been merged.
