Repository navigation
Fix a merge at a branch tip losing a parent line in the graph - #17
Merged
Merged
Conversation
A merge commit at a branch tip takes a new column on the right, which no pipe ends in, so the search for its second parent's column could return that same column: the two pipes overlapped and one was dropped on the next row, and the parent turned up later as a tip of its own. lazygit's layout has the same bug. The property test now checks that no pipe vanishes between rows and that no two lines go down in one column.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A merge commit at the tip of a branch (no child listed above it) could lose one of its two parent lines in the History graph. When no lane to its left was free, the second parent's line was given the merge's own column, the two lines lay on top of each other, and the next row dropped one of them. Any "Merge branch 'main' into feature" tip could hit it; in a real repo it drew the HEAD merge without its `─╮` and drew the heavy current-branch line thin.
The same flaw exists in upstream lazygit's `getNextPipes`, which the layout is ported from. The fix is one condition in `next_pipes`: an extra parent takes the first column that is not taken, not crossed by a continuing line, and not the commit's own column.
Tests
cargo test --workspaceand clippy are clean.