Skip to content

[Enhancement] Add new graph-highlighting option "Selected Commits (only first-parent)" - #2646

Open
goran-w wants to merge 5 commits into
sourcegit-scm:developfrom
goran-w:improve_graph_highlighting
Open

[Enhancement] Add new graph-highlighting option "Selected Commits (only first-parent)"#2646
goran-w wants to merge 5 commits into
sourcegit-scm:developfrom
goran-w:improve_graph_highlighting

Conversation

@goran-w

@goran-w goran-w commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

This PR does some refactoring of the graph-highlighting code and adds a new highlighting-option variant "Selected Commits (only first-parent)".

The new highlighting-option is similar to the existing highlighting-option "Selected Commits Only", but restricted to only ever highlighting the first-parent when going backwards in history from the selected commit(s). This feature was first discussed in comments on a related issue here.

I find it very helpful to restrict the highlighting to first-parent, while still drawing the other parents. I've implemented it in the easiest way I could find, which was to only apply it to "selected commits" in a new option variant. (It would be possible, but a bit more involved, to instead implement it as a separate "perpendicular" option that could be applied to the "All" and "Current branch" variants as well...)

NOTE: This new highlighting-option is somewhat related to the Git-option --first-parent (which is applied by SourceGit's show-flag "First-parent only"), but it's not the same! The new option only restricts the highlighting of non-first-parents, while the existing show-flag hides them entirely. (Also, the option and flag can be used simultaneously without issues.)

@goran-w
goran-w force-pushed the improve_graph_highlighting branch from 57309e2 to befcd17 Compare August 22, 2026 23:21
@goran-w goran-w changed the title [Enhancement] Add new graph-highlighting option "Selected Commits (Only First Parent)" [Enhancement] Add new graph-highlighting option "Selected Commits (only first-parent)" Aug 22, 2026
@goran-w
goran-w force-pushed the improve_graph_highlighting branch from befcd17 to f15eaf8 Compare August 23, 2026 18:26
* The remaining parents are covered further down (under condition '!firstParentOnlyEnabled').
* This is made in prep for upcoming work on adding a new highlighting option.
@goran-w
goran-w force-pushed the improve_graph_highlighting branch from f15eaf8 to 3ede806 Compare August 23, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant