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

Remove unused field from RevisionDiffController #8927

Merged
merged 1 commit into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions GitUI/CommandsDialogs/RevisionDiffControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public partial class RevisionDiffControl : GitModuleControl

private RevisionGridControl? _revisionGrid;
private RevisionFileTreeControl? _revisionFileTree;
private IRevisionDiffController? _revisionDiffController;
private readonly IRevisionDiffController _revisionDiffController = new RevisionDiffController();
private readonly IFileStatusListContextMenuController _revisionDiffContextMenuController;
private readonly IFullPathResolver _fullPathResolver;
private readonly IFindFilePredicateProvider _findFilePredicateProvider;
Expand Down Expand Up @@ -234,8 +234,6 @@ public void InitSplitterManager(SplitterManager splitterManager)

protected override void OnRuntimeLoad()
{
_revisionDiffController = new RevisionDiffController(_gitRevisionTester);

DiffFiles.DescribeRevision = objectId => DescribeRevision(objectId);
DiffText.SetFileLoader(GetNextPatchFile);
DiffText.Font = AppSettings.FixedWidthFont;
Expand Down Expand Up @@ -518,8 +516,6 @@ private void UpdateStatusOfMenuItems()
? new Font(fileHistoryDiffToolstripMenuItem.Font, FontStyle.Regular)
: new Font(fileHistoryDiffToolstripMenuItem.Font, FontStyle.Bold);

Validates.NotNull(_revisionDiffController);

diffUpdateSubmoduleMenuItem.Visible =
diffResetSubmoduleChanges.Visible =
diffStashSubmoduleChangesToolStripMenuItem.Visible =
Expand Down
7 changes: 0 additions & 7 deletions GitUI/CommandsDialogs/RevisionDiffController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ public sealed class ContextMenuSelectionInfo

public sealed class RevisionDiffController : IRevisionDiffController
{
private readonly IGitRevisionTester _revisionTester;

public RevisionDiffController(IGitRevisionTester revisionTester)
{
_revisionTester = revisionTester;
}

// The enabling of menu items is related to how the actions have been implemented

public bool ShouldShowDifftoolMenus(ContextMenuSelectionInfo selectionInfo)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
using FluentAssertions;
using GitCommands.Git;
using GitUI.CommandsDialogs;
using GitUIPluginInterfaces;
using NSubstitute;
using NUnit.Framework;

namespace GitUITests.CommandsDialogs
{
[TestFixture]
public class RevisionDiffControllerTests
{
private IGitRevisionTester _tester;
private RevisionDiffController _controller;
private readonly RevisionDiffController _controller = new();

[SetUp]
public void Setup()
{
_tester = Substitute.For<IGitRevisionTester>();

_controller = new RevisionDiffController(_tester);
}

private ContextMenuSelectionInfo CreateContextMenuSelectionInfo(GitRevision selectedRevision = null,
private static ContextMenuSelectionInfo CreateContextMenuSelectionInfo(GitRevision selectedRevision = null,
bool isDisplayOnlyDiff = false,
bool isStatusOnly = false,
int selectedGitItemCount = 1,
Expand Down