Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RevGrid: Optimize onlyFirstParent handling #10082

Merged
merged 1 commit into from
Jul 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion GitUI/UserControls/RevisionGrid/RevisionGridControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ public void PerformRefreshRevisions(Func<RefsFilter, IReadOnlyList<IGitRef>> get
bool firstRevisionReceived = false;
bool headIsHandled = false;
bool hasAnyNotes = false;
bool onlyFirstParent = false;

// getRefs (refreshing from Browse) is Lazy already, but not from RevGrid (updating filters etc)
Lazy<IReadOnlyList<IGitRef>> getUnfilteredRefs = new(() => (getRefs ?? capturedModule.GetRefs)(RefsFilter.NoFilter));
Expand Down Expand Up @@ -956,6 +957,7 @@ public void PerformRefreshRevisions(Func<RefsFilter, IReadOnlyList<IGitRef>> get

// optimize for no notes at all
hasAnyNotes = AppSettings.ShowGitNotes && getUnfilteredRefs.Value.Any(i => i.CompleteName == GitRefName.RefsNotesPrefix);
onlyFirstParent = _filterInfo.RefFilterOptions.HasFlag(RefFilterOptions.FirstParent);

// Allow add revisions to the grid
semaphoreUpdateGrid.Release();
Expand Down Expand Up @@ -1167,7 +1169,7 @@ void OnRevisionRead(GitRevision revision)
flags |= RevisionNodeFlags.HasRef;
}

if (_filterInfo.RefFilterOptions.HasFlag(RefFilterOptions.FirstParent))
if (onlyFirstParent)
{
flags |= RevisionNodeFlags.OnlyFirstParent;
}
Expand Down