[Enhancement] Add new graph-highlighting option "Selected Commits (only first-parent)" - #2646
Open
goran-w wants to merge 5 commits into
Open
[Enhancement] Add new graph-highlighting option "Selected Commits (only first-parent)"#2646goran-w wants to merge 5 commits into
goran-w wants to merge 5 commits into
Conversation
goran-w
force-pushed
the
improve_graph_highlighting
branch
from
August 22, 2026 23:21
57309e2 to
befcd17
Compare
goran-w
force-pushed
the
improve_graph_highlighting
branch
from
August 23, 2026 18:26
befcd17 to
f15eaf8
Compare
* 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
force-pushed
the
improve_graph_highlighting
branch
from
August 23, 2026 18:38
f15eaf8 to
3ede806
Compare
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.
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.)