diff --git a/GitCommands/RevisionReader.cs b/GitCommands/RevisionReader.cs index 9b4c0f0fe72..4b9f3646f93 100644 --- a/GitCommands/RevisionReader.cs +++ b/GitCommands/RevisionReader.cs @@ -36,10 +36,25 @@ public sealed class RevisionReader /* Commit raw body */ "%B"; // Trace info for parse errors - private static int _noOfParseError = 0; + private int _noOfParseError = 0; - public async Task ExecuteAsync( - GitModule module, + private readonly GitModule _module; + private readonly Encoding _logOutputEncoding; + private readonly long _sixMonths; + + public RevisionReader(GitModule module) + : this(module, module.LogOutputEncoding, new DateTimeOffset(DateTime.Now.ToUniversalTime() - TimeSpan.FromDays(30 * 6)).ToUnixTimeSeconds()) + { + } + + internal RevisionReader(GitModule module, Encoding logOutputEncoding, long sixMonths) + { + _module = module; + _logOutputEncoding = logOutputEncoding; + _sixMonths = sixMonths; + } + + public async Task GetLogAsync( IObserver subject, ArgumentBuilder arguments, CancellationToken token) @@ -47,16 +62,12 @@ public sealed class RevisionReader await TaskScheduler.Default; token.ThrowIfCancellationRequested(); - var revisionCount = 0; - #if DEBUG + int revisionCount = 0; var sw = Stopwatch.StartNew(); #endif - var logOutputEncoding = module.LogOutputEncoding; - long sixMonths = new DateTimeOffset(DateTime.Now.ToUniversalTime() - TimeSpan.FromDays(30 * 6)).ToUnixTimeSeconds(); - - using (var process = module.GitCommandRunner.RunDetached(arguments, redirectOutput: true, outputEncoding: GitModule.LosslessEncoding)) + using (var process = _module.GitCommandRunner.RunDetached(arguments, redirectOutput: true, outputEncoding: GitModule.LosslessEncoding)) { #if DEBUG Debug.WriteLine($"git {arguments}"); @@ -69,10 +80,11 @@ public sealed class RevisionReader { token.ThrowIfCancellationRequested(); - if (TryParseRevision(chunk, logOutputEncoding, sixMonths, out GitRevision? revision)) + if (TryParseRevision(chunk, out GitRevision? revision)) { +#if DEBUG revisionCount++; - +#endif subject.OnNext(revision); } } @@ -89,7 +101,7 @@ public sealed class RevisionReader } } - public static ArgumentBuilder BuildArguments(int maxCount, + public ArgumentBuilder BuildArguments(int maxCount, RefFilterOptions refFilterOptions, string branchFilter, string revisionFilter, @@ -155,7 +167,7 @@ public sealed class RevisionReader branchFilter.IndexOfAny(new[] { '?', '*', '[' }) == -1; } - private static bool TryParseRevision(in ArraySegment chunk, in Encoding logOutputEncoding, long sixMonths, [NotNullWhen(returnValue: true)] out GitRevision? revision) + private bool TryParseRevision(in ArraySegment chunk, [NotNullWhen(returnValue: true)] out GitRevision? revision) { // The 'chunk' of data contains a complete git log item, encoded. // This method decodes that chunk and produces a revision object. @@ -275,7 +287,7 @@ long ParseUnixDateTime(in ReadOnlySpan array) #region Encoded string values (names, emails, subject, body) // Finally, decode the names, email, subject and body strings using the required text encoding - ReadOnlySpan s = logOutputEncoding.GetString(array[offset..]).AsSpan(); + ReadOnlySpan s = _logOutputEncoding.GetString(array[offset..]).AsSpan(); StringLineReader reader = new(in s); var author = reader.ReadLine(); @@ -283,7 +295,7 @@ long ParseUnixDateTime(in ReadOnlySpan array) var committer = reader.ReadLine(); var committerEmail = reader.ReadLine(); - bool skipBody = sixMonths > authorUnixTime; + bool skipBody = _sixMonths > authorUnixTime; (string? subject, string? body, bool hasMultiLineMessage) = reader.PeekSubjectBody(skipBody); // We keep a full multiline message body within the last six months. @@ -317,7 +329,7 @@ long ParseUnixDateTime(in ReadOnlySpan array) return true; - static void ParseAssert(string? message) + void ParseAssert(string? message) { _noOfParseError++; Debug.Assert(_noOfParseError > 1, message); @@ -402,13 +414,13 @@ internal TestAccessor(RevisionReader revisionReader) _revisionReader = revisionReader; } - internal static bool TryParseRevision(ArraySegment chunk, Encoding logOutputEncoding, long sixMonths, [NotNullWhen(returnValue: true)] out GitRevision? revision) => - RevisionReader.TryParseRevision(chunk, logOutputEncoding, sixMonths, out revision); + internal bool TryParseRevision(ArraySegment chunk, [NotNullWhen(returnValue: true)] out GitRevision? revision) => + _revisionReader.TryParseRevision(chunk, out revision); - internal static int NoOfParseError + internal int NoOfParseError { - get { return _noOfParseError; } - set { _noOfParseError = value; } + get { return _revisionReader._noOfParseError; } + set { _revisionReader._noOfParseError = value; } } } } diff --git a/GitUI/UserControls/RevisionGrid/Columns/RevisionGraphColumnProvider.cs b/GitUI/UserControls/RevisionGrid/Columns/RevisionGraphColumnProvider.cs index e01d96b3515..e90094e8168 100644 --- a/GitUI/UserControls/RevisionGrid/Columns/RevisionGraphColumnProvider.cs +++ b/GitUI/UserControls/RevisionGrid/Columns/RevisionGraphColumnProvider.cs @@ -315,8 +315,8 @@ void DrawItem() int centerX = g.RenderingOrigin.X + (int)((currentRow.GetCurrentRevisionLane() + 0.5) * LaneWidth); Rectangle nodeRect = new(centerX - (NodeDimension / 2), centerY - (NodeDimension / 2), NodeDimension, NodeDimension); - bool square = currentRow.Revision.HasRef; - bool hasOutline = currentRow.Revision.IsCheckedOut; + bool square = currentRow.Revision.GitRevision.Refs.Count > 0; + bool hasOutline = currentRow.Revision.GitRevision.ObjectId == _revisionGraph.HeadId; Brush brush = GetBrushForLaneInfo(currentRowRevisionLaneInfo, currentRow.Revision.IsRelative); if (square) diff --git a/GitUI/UserControls/RevisionGrid/Graph/RevisionGraph.cs b/GitUI/UserControls/RevisionGrid/Graph/RevisionGraph.cs index b0a35b40e52..302eb6f4806 100644 --- a/GitUI/UserControls/RevisionGrid/Graph/RevisionGraph.cs +++ b/GitUI/UserControls/RevisionGrid/Graph/RevisionGraph.cs @@ -65,6 +65,9 @@ public void LoadingCompleted() public int Count => _nodes.Count; + public bool OnlyFirstParent { get; set; } + public ObjectId HeadId { get; set; } + /// /// Checks whether the given hash is present in the graph. /// @@ -177,14 +180,25 @@ public void HighlightBranch(ObjectId id) } } + /// + /// Set HasNotes for all GitRevisions (marking Notes as fetched). + /// This is used when no Git Notes at all exist and notes never need to be retrieved. + /// + public void SetHasNotesForRevisions() + { + foreach (RevisionGraphRevision revision in _nodes) + { + revision.GitRevision.HasNotes = true; + } + } + /// /// Add a single revision from the git log to the graph, including segments to parents. /// /// The revision to add. - /// The graph node flags. /// Insert the (artificial) revision before the node with this score. /// Number of scores "reserved" in the list when inserting. - public void Add(GitRevision revision, RevisionNodeFlags types, int? insertScore = null, int insertRange = 0) + public void Add(GitRevision revision, int? insertScore = null, int insertRange = 0) { // The commits are sorted by the score (not contiuous numbering there may be gaps) // This commit will be ordered after existing, _maxScore is a preliminary score @@ -233,7 +247,7 @@ public void Add(GitRevision revision, RevisionNodeFlags types, int? insertScore // This revision may have been added as a parent before. Probably only the ObjectId is known. Set all the other properties. revisionGraphRevision.GitRevision = revision; - revisionGraphRevision.ApplyFlags(types); + revisionGraphRevision.ApplyFlags(isCheckedOut: HeadId == revision.ObjectId); // Build the revisions parent/child structure. The parents need to added here. The child structure is kept in synch in // the RevisionGraphRevision class. @@ -265,7 +279,7 @@ public void Add(GitRevision revision, RevisionNodeFlags types, int? insertScore revisionGraphRevision.AddParent(parentRevisionGraphRevision, out int newMaxScore); _maxScore = Math.Max(_maxScore, newMaxScore); - if (types.HasFlag(RevisionNodeFlags.OnlyFirstParent)) + if (OnlyFirstParent) { break; } diff --git a/GitUI/UserControls/RevisionGrid/Graph/RevisionGraphRevision.cs b/GitUI/UserControls/RevisionGrid/Graph/RevisionGraphRevision.cs index 2413b41c563..a0569cdb38f 100644 --- a/GitUI/UserControls/RevisionGrid/Graph/RevisionGraphRevision.cs +++ b/GitUI/UserControls/RevisionGrid/Graph/RevisionGraphRevision.cs @@ -24,16 +24,12 @@ public RevisionGraphRevision(ObjectId objectId, int guessScore) Score = guessScore; } - public void ApplyFlags(RevisionNodeFlags types) + public void ApplyFlags(bool isCheckedOut) { - IsRelative |= (types & RevisionNodeFlags.CheckedOut) != 0; - HasRef = (types & RevisionNodeFlags.HasRef) != 0; - IsCheckedOut = (types & RevisionNodeFlags.CheckedOut) != 0; + IsRelative |= isCheckedOut; } public bool IsRelative { get; set; } - public bool HasRef { get; set; } - public bool IsCheckedOut { get; set; } /// /// The score is used to order the revisions in topo-order. The initial score will be assigned when a revision is loaded diff --git a/GitUI/UserControls/RevisionGrid/RevisionDataGridView.cs b/GitUI/UserControls/RevisionGrid/RevisionDataGridView.cs index 6e1d38f9530..60018ad4d7b 100644 --- a/GitUI/UserControls/RevisionGrid/RevisionDataGridView.cs +++ b/GitUI/UserControls/RevisionGrid/RevisionDataGridView.cs @@ -20,15 +20,6 @@ namespace GitUI.UserControls.RevisionGrid { - [Flags] - public enum RevisionNodeFlags - { - None = 0, - CheckedOut = 1, - HasRef = 2, - OnlyFirstParent = 4 - } - public sealed partial class RevisionDataGridView : DataGridView { private const int BackgroundThreadUpdatePeriod = 25; @@ -321,11 +312,10 @@ private void OnCellPainting(object? sender, DataGridViewCellPaintingEventArgs e) /// Update visible rows if needed. /// /// The revision to add. - /// The graph node flags. /// Insert the (artificial) revision with the first match in headParents or first if no match found (or headParents is null). /// Number of scores "reserved" in the list when inserting. /// Parent ids for the revision to find (and insert before). - public void Add(GitRevision revision, RevisionNodeFlags types = RevisionNodeFlags.None, bool insertWithMatch = false, int insertRange = 0, IEnumerable? parents = null) + public void Add(GitRevision revision, bool insertWithMatch = false, int insertRange = 0, IEnumerable? parents = null) { // Where to insert the revision, null is last int? insertScore = null; @@ -358,7 +348,7 @@ public void Add(GitRevision revision, RevisionNodeFlags types = RevisionNodeFlag } } - _revisionGraph.Add(revision, types, insertScore, insertRange); + _revisionGraph.Add(revision, insertScore, insertRange); if (ToBeSelectedObjectIds.Contains(revision.ObjectId)) { ++_loadedToBeSelectedRevisionsCount; diff --git a/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs b/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs index e9e219a1f7a..99baec48fcb 100644 --- a/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs +++ b/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs @@ -884,8 +884,6 @@ public void PerformRefreshRevisions(Func> get ILookup refsByObjectId = null; 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> getUnfilteredRefs = new(() => (getRefs ?? capturedModule.GetRefs)(RefsFilter.NoFilter)); @@ -959,9 +957,8 @@ public void PerformRefreshRevisions(Func> get UpdateSelectedRef(capturedModule, getUnfilteredRefs.Value, headRef); _gridView.ToBeSelectedObjectIds = GetToBeSelectedRevisions(newCurrentCheckout, currentlySelectedObjectIds); - // optimize for no notes at all - hasAnyNotes = AppSettings.ShowGitNotes && getUnfilteredRefs.Value.Any(i => i.CompleteName == GitRefName.RefsNotesPrefix); - onlyFirstParent = _filterInfo.RefFilterOptions.HasFlag(RefFilterOptions.FirstParent); + _gridView._revisionGraph.OnlyFirstParent = _filterInfo.RefFilterOptions.HasFlag(RefFilterOptions.FirstParent); + _gridView._revisionGraph.HeadId = CurrentCheckout; // Allow add revisions to the grid semaphoreUpdateGrid.Release(); @@ -981,8 +978,9 @@ public void PerformRefreshRevisions(Func> get ThreadHelper.JoinableTaskFactory.RunAsync(async () => { await TaskScheduler.Default; + RevisionReader reader = new(capturedModule); string pathFilter = BuildPathFilter(_filterInfo.PathFilter); - ArgumentBuilder args = RevisionReader.BuildArguments(_filterInfo.CommitsLimit, + ArgumentBuilder args = reader.BuildArguments(_filterInfo.CommitsLimit, _filterInfo.RefFilterOptions, _filterInfo.IsShowFilteredBranchesChecked ? _filterInfo.BranchFilter : string.Empty, _filterInfo.GetRevisionFilter(), @@ -990,8 +988,7 @@ public void PerformRefreshRevisions(Func> get out bool parentsAreRewritten); ParentsAreRewritten = parentsAreRewritten; - await new RevisionReader().ExecuteAsync( - capturedModule, + await reader.GetLogAsync( observeRevisions, args, cancellationToken); @@ -1147,44 +1144,23 @@ void OnRevisionRead(GitRevision revision) if (!firstRevisionReceived) { // Wait for refs,CurrentCheckout to be available + this.InvokeAsync(() => { ShowLoading(showSpinner: false); }).FileAndForget(); semaphoreUpdateGrid.Wait(cancellationToken); firstRevisionReceived = true; - this.InvokeAsync(() => { ShowLoading(showSpinner: false); }).FileAndForget(); } - RevisionNodeFlags flags = RevisionNodeFlags.None; - if (!headIsHandled && (revision.ObjectId.Equals(CurrentCheckout) || CurrentCheckout is null)) { // Insert worktree/index before HEAD (CurrentCheckout) // If grid is filtered and HEAD not visible, insert artificial in OnRevisionReadCompleted() headIsHandled = true; AddArtificialRevisions(); - if (CurrentCheckout is not null) - { - flags = RevisionNodeFlags.CheckedOut; - } } // Look up any refs associated with this revision revision.Refs = refsByObjectId[revision.ObjectId].AsReadOnlyList(); - if (revision.Refs.Count != 0) - { - flags |= RevisionNodeFlags.HasRef; - } - - if (onlyFirstParent) - { - flags |= RevisionNodeFlags.OnlyFirstParent; - } - if (!hasAnyNotes) - { - // No notes at all in this repo - revision.HasNotes = true; - } - - _gridView.Add(revision, flags); + _gridView.Add(revision); return; } @@ -1349,6 +1325,17 @@ void OnRevisionReadCompleted() RevisionsLoaded?.Invoke(this, new RevisionLoadEventArgs(this, UICommands, getUnfilteredRefs, forceRefresh)); HighlightRevisionsByAuthor(GetSelectedRevisions()); + await TaskScheduler.Default; + + // optimize for no notes at all in repo + // Improvement: set .HasNotes for commits not included in git-notes + bool hasAnyNotes = AppSettings.ShowGitNotes && getUnfilteredRefs.Value.Any(i => i.CompleteName == GitRefName.RefsNotesPrefix); + if (!hasAnyNotes) + { + // No notes at all in this repo + _gridView._revisionGraph.SetHasNotesForRevisions(); + } + if (ShowBuildServerInfo) { await _buildServerWatcher.LaunchBuildServerInfoFetchOperationAsync(); diff --git a/UnitTests/GitCommands.Tests/RevisionReaderTests.cs b/UnitTests/GitCommands.Tests/RevisionReaderTests.cs index cb1655280e3..6ef982c5778 100644 --- a/UnitTests/GitCommands.Tests/RevisionReaderTests.cs +++ b/UnitTests/GitCommands.Tests/RevisionReaderTests.cs @@ -8,6 +8,7 @@ using ApprovalTests.Reporters.ContinuousIntegration; using FluentAssertions; using GitCommands; +using GitExtUtils; using GitUIPluginInterfaces; using Newtonsoft.Json; using NUnit.Framework; @@ -17,22 +18,20 @@ namespace GitCommandsTests [TestFixture] public sealed class RevisionReaderTests { - private RevisionReader _revisionReader; - private Encoding _logOutputEncoding = Encoding.UTF8; private long _sixMonths = new DateTimeOffset(new DateTime(2021, 01, 01)).ToUnixTimeSeconds(); [SetUp] public void Setup() { - _revisionReader = new RevisionReader(); } [TestCase(0, false)] [TestCase(1, true)] public void BuildArguments_should_add_maxcount_if_requested(int maxCount, bool expected) { - var args = RevisionReader.BuildArguments(maxCount, RefFilterOptions.All, "", "", "", out bool parentsAreRewritten); + RevisionReader reader = new(new GitModule(""), _logOutputEncoding, _sixMonths); + ArgumentBuilder args = reader.BuildArguments(maxCount, RefFilterOptions.All, "", "", "", out bool parentsAreRewritten); if (expected) { @@ -49,7 +48,8 @@ public void BuildArguments_should_add_maxcount_if_requested(int maxCount, bool e [Test] public void BuildArguments_should_be_NUL_terminated() { - var args = RevisionReader.BuildArguments(-1, RefFilterOptions.All, "", "", "", out bool parentsAreRewritten); + RevisionReader reader = new(new GitModule(""), _logOutputEncoding, _sixMonths); + ArgumentBuilder args = reader.BuildArguments(-1, RefFilterOptions.All, "", "", "", out bool parentsAreRewritten); args.ToString().Should().Contain(" log -z "); parentsAreRewritten.Should().BeFalse(); @@ -61,7 +61,8 @@ public void BuildArguments_should_be_NUL_terminated() [TestCase(RefFilterOptions.All | RefFilterOptions.Reflogs, true)] public void BuildArguments_should_add_reflog_if_requested(RefFilterOptions refFilterOptions, bool expected) { - var args = RevisionReader.BuildArguments(-1, refFilterOptions, "", "", "", out bool parentsAreRewritten); + RevisionReader reader = new(new GitModule(""), _logOutputEncoding, _sixMonths); + ArgumentBuilder args = reader.BuildArguments(-1, refFilterOptions, "", "", "", out bool parentsAreRewritten); if (expected) { @@ -96,7 +97,8 @@ public void BuildArguments_should_add_reflog_if_requested(RefFilterOptions refFi [TestCase(RefFilterOptions.NoGitNotes, null, " --not --glob=notes --not ")] public void BuildArguments_check_parameters(RefFilterOptions refFilterOptions, string expectedToContain, string notExpectedToContain) { - var args = RevisionReader.BuildArguments(-1, refFilterOptions, "my_*", "my_revision", "my_path", out bool parentsAreRewritten); + RevisionReader reader = new(new GitModule(""), _logOutputEncoding, _sixMonths); + ArgumentBuilder args = reader.BuildArguments(-1, refFilterOptions, "my_*", "my_revision", "my_path", out bool parentsAreRewritten); if (expectedToContain is not null) { @@ -115,8 +117,11 @@ public void BuildArguments_check_parameters(RefFilterOptions refFilterOptions, s public void TryParseRevisionshould_return_false_if_argument_is_invalid() { ArraySegment chunk = null; + RevisionReader reader = new(new GitModule(""), _logOutputEncoding, _sixMonths); - bool res = RevisionReader.TestAccessor.TryParseRevision(chunk, _logOutputEncoding, _sixMonths, out _); + // Set to a high value so Debug.Assert do not raise exceptions + reader.GetTestAccessor().NoOfParseError = 100; + bool res = reader.GetTestAccessor().TryParseRevision(chunk, out _); res.Should().BeFalse(); } @@ -145,10 +150,11 @@ public void TryParseRevision_test(string testName, bool expectedReturn, bool ser { string path = Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData/RevisionReader", testName + ".bin"); ArraySegment chunk = File.ReadAllBytes(path); + RevisionReader reader = new(new GitModule(""), _logOutputEncoding, _sixMonths); // Set to a high value so Debug.Assert do not raise exceptions - RevisionReader.TestAccessor.NoOfParseError = 100; - RevisionReader.TestAccessor.TryParseRevision(chunk, _logOutputEncoding, _sixMonths, out GitRevision rev) + reader.GetTestAccessor().NoOfParseError = 100; + reader.GetTestAccessor().TryParseRevision(chunk, out GitRevision rev) .Should().Be(expectedReturn); // No LocalTime for the time stamps diff --git a/UnitTests/GitUI.Tests/UserControls/RevisionGrid/Graph/RevisionGraphMultiThreadingTests.cs b/UnitTests/GitUI.Tests/UserControls/RevisionGrid/Graph/RevisionGraphMultiThreadingTests.cs index 7556071ccb5..0ce10c9e7cb 100644 --- a/UnitTests/GitUI.Tests/UserControls/RevisionGrid/Graph/RevisionGraphMultiThreadingTests.cs +++ b/UnitTests/GitUI.Tests/UserControls/RevisionGrid/Graph/RevisionGraphMultiThreadingTests.cs @@ -34,9 +34,10 @@ public void Setup() _revisionGraph = new RevisionGraph(); GitRevision revision = new(ObjectId.Random()); + _revisionGraph.HeadId = revision.ObjectId; // Mark the first revision as the current checkout - _revisionGraph.Add(revision, RevisionNodeFlags.CheckedOut); + _revisionGraph.Add(revision); } [Test, Timeout(10 /*min*/ * 60 /*s*/ * 1000 /*ms*/)] @@ -84,7 +85,7 @@ private void LoadRandomRevisions() revision.ParentIds = new ObjectId[] { randomRevision1.ObjectId, randomRevision2.ObjectId }; } - _revisionGraph.Add(revision, RevisionNodeFlags.None); + _revisionGraph.Add(revision); randomRevisions.Add(revision); } diff --git a/UnitTests/GitUI.Tests/UserControls/RevisionGrid/Graph/RevisionGraphTests.cs b/UnitTests/GitUI.Tests/UserControls/RevisionGrid/Graph/RevisionGraphTests.cs index 43749947c72..02bbed5affa 100644 --- a/UnitTests/GitUI.Tests/UserControls/RevisionGrid/Graph/RevisionGraphTests.cs +++ b/UnitTests/GitUI.Tests/UserControls/RevisionGrid/Graph/RevisionGraphTests.cs @@ -19,7 +19,12 @@ public void Setup() foreach (var revision in Revisions) { // Mark the first revision as the current checkout - _revisionGraph.Add(revision, _revisionGraph.Count == 0 ? RevisionNodeFlags.CheckedOut : RevisionNodeFlags.None); + if (_revisionGraph.Count == 0) + { + _revisionGraph.HeadId = revision.ObjectId; + } + + _revisionGraph.Add(revision); } } @@ -82,12 +87,12 @@ public void ShouldReorderInTopoOrder() commit1.ParentIds = new ObjectId[] { commit2.ObjectId }; commit2.ParentIds = new ObjectId[] { _revisionGraph.GetNodeForRow(4).Objectid }; - _revisionGraph.Add(commit2, RevisionNodeFlags.None); // This commit is now dangling + _revisionGraph.Add(commit2); // This commit is now dangling _revisionGraph.CacheTo(_revisionGraph.Count, _revisionGraph.Count); Assert.IsTrue(_revisionGraph.GetTestAccessor().ValidateTopoOrder()); - _revisionGraph.Add(commit1, RevisionNodeFlags.None); // Add the connecting commit + _revisionGraph.Add(commit1); // Add the connecting commit _revisionGraph.CacheTo(_revisionGraph.Count, _revisionGraph.Count); Assert.IsTrue(_revisionGraph.GetTestAccessor().ValidateTopoOrder()); @@ -95,7 +100,7 @@ public void ShouldReorderInTopoOrder() // Add a new head GitRevision newHead = new(ObjectId.Random()); newHead.ParentIds = new ObjectId[] { _revisionGraph.GetNodeForRow(0).Objectid }; - _revisionGraph.Add(newHead, RevisionNodeFlags.None); // Add commit that has the current top node as parent. + _revisionGraph.Add(newHead); // Add commit that has the current top node as parent. _revisionGraph.CacheTo(_revisionGraph.Count, _revisionGraph.Count); // Call to cache fix the order Assert.IsTrue(_revisionGraph.GetTestAccessor().ValidateTopoOrder()); @@ -129,9 +134,9 @@ public void DetachedSingleRevision() GitRevision commit3 = new(ObjectId.Random()); commit1.ParentIds = new ObjectId[] { commit3.ObjectId }; - _revisionGraph.Add(commit1, RevisionNodeFlags.None); - _revisionGraph.Add(commit2, RevisionNodeFlags.None); - _revisionGraph.Add(commit3, RevisionNodeFlags.None); + _revisionGraph.Add(commit1); + _revisionGraph.Add(commit2); + _revisionGraph.Add(commit3); _revisionGraph.CacheTo(_revisionGraph.Count, _revisionGraph.Count);