From 493906047e03873e0336dbdebe91bd4f77f655d4 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:03:09 -0400 Subject: [PATCH 01/32] Removing unused success variable in GitConfig --- src/GitHub.Api/Git/GitConfig.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GitHub.Api/Git/GitConfig.cs b/src/GitHub.Api/Git/GitConfig.cs index c80d59662..05ce1bb10 100644 --- a/src/GitHub.Api/Git/GitConfig.cs +++ b/src/GitHub.Api/Git/GitConfig.cs @@ -216,16 +216,16 @@ public string GetString(string key) public int GetInt(string key) { var value = this[key]; - var result = 0; - var success = int.TryParse(value, out result); + int result = 0; + int.TryParse(value, out result); return result; } public float GetFloat(string key) { var value = this[key]; - var result = 0F; - var success = float.TryParse(value, out result); + float result = 0F; + float.TryParse(value, out result); return result; } From e4de8445d8bcc4ae1353042e2c57890363d0e62d Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:04:49 -0400 Subject: [PATCH 02/32] Removing unused functionality to disable the native interface in RepositoryWatcher --- src/GitHub.Api/Events/RepositoryWatcher.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/GitHub.Api/Events/RepositoryWatcher.cs b/src/GitHub.Api/Events/RepositoryWatcher.cs index b72d6bd3c..da1a07043 100644 --- a/src/GitHub.Api/Events/RepositoryWatcher.cs +++ b/src/GitHub.Api/Events/RepositoryWatcher.cs @@ -30,7 +30,6 @@ class RepositoryWatcher : IRepositoryWatcher private readonly CancellationToken cancellationToken; private readonly NPath[] ignoredPaths; private readonly ManualResetEventSlim pauseEvent; - private readonly bool disableNative; private NativeInterface nativeInterface; private bool running; private Task task; @@ -68,8 +67,7 @@ public void Initialize() try { - if (!disableNative) - nativeInterface = new NativeInterface(pathsRepositoryPath); + nativeInterface = new NativeInterface(pathsRepositoryPath); } catch (Exception ex) { @@ -79,12 +77,6 @@ public void Initialize() public void Start() { - if (disableNative) - { - Logger.Trace("Native interface is disabled"); - return; - } - if (nativeInterface == null) { Logger.Warning("NativeInterface is null"); From 7bdd974e81156dcd79d4a0866fde0460c562097e Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:05:49 -0400 Subject: [PATCH 03/32] Removing unused string builder --- src/GitHub.Api/NewTaskSystem/BaseOutputProcessor.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GitHub.Api/NewTaskSystem/BaseOutputProcessor.cs b/src/GitHub.Api/NewTaskSystem/BaseOutputProcessor.cs index 9456c7c43..1c2f2ea0d 100644 --- a/src/GitHub.Api/NewTaskSystem/BaseOutputProcessor.cs +++ b/src/GitHub.Api/NewTaskSystem/BaseOutputProcessor.cs @@ -84,7 +84,6 @@ public override void LineReceived(string line) abstract class FirstResultOutputProcessor : BaseOutputProcessor { - private readonly StringBuilder sb = new StringBuilder(); private bool isSet = false; public override void LineReceived(string line) { From de70b7f9dbf91c2b131fb47e8629024a9df94f22 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:09:47 -0400 Subject: [PATCH 04/32] Removing UsageTracker from RepositoryManager --- src/GitHub.Api/Application/ApplicationManagerBase.cs | 2 +- src/GitHub.Api/Git/RepositoryManager.cs | 8 +++----- src/tests/IntegrationTests/BaseGitEnvironmentTest.cs | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/GitHub.Api/Application/ApplicationManagerBase.cs b/src/GitHub.Api/Application/ApplicationManagerBase.cs index d0eb0bc3e..fb791bcae 100644 --- a/src/GitHub.Api/Application/ApplicationManagerBase.cs +++ b/src/GitHub.Api/Application/ApplicationManagerBase.cs @@ -127,7 +127,7 @@ public void RestartRepository() { if (Environment.RepositoryPath != null) { - repositoryManager = Unity.RepositoryManager.CreateInstance(Platform, TaskManager, UsageTracker, GitClient, Environment.RepositoryPath); + repositoryManager = Unity.RepositoryManager.CreateInstance(Platform, TaskManager, GitClient, Environment.RepositoryPath); repositoryManager.Initialize(); Environment.Repository.Initialize(repositoryManager); repositoryManager.Start(); diff --git a/src/GitHub.Api/Git/RepositoryManager.cs b/src/GitHub.Api/Git/RepositoryManager.cs index e3892806a..90f9c7b32 100644 --- a/src/GitHub.Api/Git/RepositoryManager.cs +++ b/src/GitHub.Api/Git/RepositoryManager.cs @@ -100,7 +100,6 @@ class RepositoryManager : IRepositoryManager private readonly IPlatform platform; private readonly IRepositoryPathConfiguration repositoryPaths; private readonly ITaskManager taskManager; - private readonly IUsageTracker usageTracker; private readonly IRepositoryWatcher watcher; private bool isBusy; @@ -119,14 +118,13 @@ class RepositoryManager : IRepositoryManager public event Action OnRemoteBranchRemoved; public event Action OnStatusUpdated; - public RepositoryManager(IPlatform platform, ITaskManager taskManager, IUsageTracker usageTracker, IGitConfig gitConfig, + public RepositoryManager(IPlatform platform, ITaskManager taskManager, IGitConfig gitConfig, IRepositoryWatcher repositoryWatcher, IGitClient gitClient, IRepositoryPathConfiguration repositoryPaths, CancellationToken cancellationToken) { this.repositoryPaths = repositoryPaths; this.platform = platform; this.taskManager = taskManager; - this.usageTracker = usageTracker; this.cancellationToken = cancellationToken; this.gitClient = gitClient; this.watcher = repositoryWatcher; @@ -135,7 +133,7 @@ public RepositoryManager(IPlatform platform, ITaskManager taskManager, IUsageTra SetupWatcher(); } - public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager taskManager, IUsageTracker usageTracker, + public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager taskManager, IGitClient gitClient, NPath repositoryRoot) { var repositoryPathConfiguration = new RepositoryPathConfiguration(repositoryRoot); @@ -144,7 +142,7 @@ public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager var repositoryWatcher = new RepositoryWatcher(platform, repositoryPathConfiguration, taskManager.Token); - return new RepositoryManager(platform, taskManager, usageTracker, gitConfig, repositoryWatcher, + return new RepositoryManager(platform, taskManager, gitConfig, repositoryWatcher, gitClient, repositoryPathConfiguration, taskManager.Token); } diff --git a/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs b/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs index e65489359..4e59da75b 100644 --- a/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs +++ b/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs @@ -30,7 +30,7 @@ protected async Task Initialize(NPath repoPath, NPath environmentP var usageTracker = new NullUsageTracker(); - RepositoryManager = GitHub.Unity.RepositoryManager.CreateInstance(Platform, TaskManager, usageTracker, GitClient, repoPath); + RepositoryManager = GitHub.Unity.RepositoryManager.CreateInstance(Platform, TaskManager, GitClient, repoPath); RepositoryManager.Initialize(); Environment.Repository = new Repository("TestRepo", repoPath); From e5c3ee8d6e4e90f63b0c0f500b69b1fa592223d9 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:16:44 -0400 Subject: [PATCH 05/32] Removing the cancellationToken from RepositoryManager --- src/GitHub.Api/Git/RepositoryManager.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/GitHub.Api/Git/RepositoryManager.cs b/src/GitHub.Api/Git/RepositoryManager.cs index 90f9c7b32..d36633f28 100644 --- a/src/GitHub.Api/Git/RepositoryManager.cs +++ b/src/GitHub.Api/Git/RepositoryManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading; using System.Threading.Tasks; namespace GitHub.Unity @@ -94,7 +93,6 @@ public RepositoryPathConfiguration(NPath repositoryPath) class RepositoryManager : IRepositoryManager { - private readonly CancellationToken cancellationToken; private readonly IGitConfig config; private readonly IGitClient gitClient; private readonly IPlatform platform; @@ -120,12 +118,11 @@ class RepositoryManager : IRepositoryManager public RepositoryManager(IPlatform platform, ITaskManager taskManager, IGitConfig gitConfig, IRepositoryWatcher repositoryWatcher, IGitClient gitClient, - IRepositoryPathConfiguration repositoryPaths, CancellationToken cancellationToken) + IRepositoryPathConfiguration repositoryPaths) { this.repositoryPaths = repositoryPaths; this.platform = platform; this.taskManager = taskManager; - this.cancellationToken = cancellationToken; this.gitClient = gitClient; this.watcher = repositoryWatcher; this.config = gitConfig; @@ -143,7 +140,7 @@ public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager var repositoryWatcher = new RepositoryWatcher(platform, repositoryPathConfiguration, taskManager.Token); return new RepositoryManager(platform, taskManager, gitConfig, repositoryWatcher, - gitClient, repositoryPathConfiguration, taskManager.Token); + gitClient, repositoryPathConfiguration); } public void Initialize() From 0bd09d65aa8cc9bdf17040ea660209d0b0ca6927 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:17:38 -0400 Subject: [PATCH 06/32] Removing unused task from RepositoryWatcher --- src/GitHub.Api/Events/RepositoryWatcher.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GitHub.Api/Events/RepositoryWatcher.cs b/src/GitHub.Api/Events/RepositoryWatcher.cs index da1a07043..6528b0d3a 100644 --- a/src/GitHub.Api/Events/RepositoryWatcher.cs +++ b/src/GitHub.Api/Events/RepositoryWatcher.cs @@ -32,7 +32,6 @@ class RepositoryWatcher : IRepositoryWatcher private readonly ManualResetEventSlim pauseEvent; private NativeInterface nativeInterface; private bool running; - private Task task; private int lastCountOfProcessedEvents = 0; private bool processingEvents; private readonly ManualResetEventSlim signalProcessingEventsDone = new ManualResetEventSlim(false); @@ -87,7 +86,7 @@ public void Start() running = true; pauseEvent.Reset(); - task = Task.Factory.StartNew(WatcherLoop, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default); + Task.Factory.StartNew(WatcherLoop, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default); } public void Stop() From 5d2582fd64b33130a4135f83de81316b8926d83e Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:18:37 -0400 Subject: [PATCH 07/32] Removing unused credential manager from GitClient --- src/GitHub.Api/Application/ApplicationManagerBase.cs | 2 +- src/GitHub.Api/Git/GitClient.cs | 5 +---- src/tests/IntegrationTests/BaseGitEnvironmentTest.cs | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/GitHub.Api/Application/ApplicationManagerBase.cs b/src/GitHub.Api/Application/ApplicationManagerBase.cs index fb791bcae..2622ec60c 100644 --- a/src/GitHub.Api/Application/ApplicationManagerBase.cs +++ b/src/GitHub.Api/Application/ApplicationManagerBase.cs @@ -39,7 +39,7 @@ protected void Initialize() Logging.TracingEnabled = UserSettings.Get(Constants.TraceLoggingKey, false); ProcessManager = new ProcessManager(Environment, Platform.GitEnvironment, CancellationToken); Platform.Initialize(ProcessManager, TaskManager); - GitClient = new GitClient(Environment, ProcessManager, Platform.CredentialManager, TaskManager); + GitClient = new GitClient(Environment, ProcessManager, TaskManager); SetupMetrics(); } diff --git a/src/GitHub.Api/Git/GitClient.cs b/src/GitHub.Api/Git/GitClient.cs index 0b7978338..63e9a4656 100644 --- a/src/GitHub.Api/Git/GitClient.cs +++ b/src/GitHub.Api/Git/GitClient.cs @@ -87,16 +87,13 @@ class GitClient : IGitClient { private readonly IEnvironment environment; private readonly IProcessManager processManager; - private readonly ICredentialManager credentialManager; private readonly ITaskManager taskManager; private readonly CancellationToken cancellationToken; - public GitClient(IEnvironment environment, IProcessManager processManager, - ICredentialManager credentialManager, ITaskManager taskManager) + public GitClient(IEnvironment environment, IProcessManager processManager, ITaskManager taskManager) { this.environment = environment; this.processManager = processManager; - this.credentialManager = credentialManager; this.taskManager = taskManager; this.cancellationToken = taskManager.Token; } diff --git a/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs b/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs index 4e59da75b..d0bd107f6 100644 --- a/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs +++ b/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs @@ -26,7 +26,7 @@ protected async Task Initialize(NPath repoPath, NPath environmentP Platform.Initialize(ProcessManager, TaskManager); - GitClient = new GitClient(Environment, ProcessManager, Platform.CredentialManager, TaskManager); + GitClient = new GitClient(Environment, ProcessManager, TaskManager); var usageTracker = new NullUsageTracker(); From 29cf4b96b66c5f9c79252060fd005aeec0e14414 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:19:34 -0400 Subject: [PATCH 08/32] Removing unused fields from ApiClient --- src/GitHub.Api/Application/ApiClient.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/GitHub.Api/Application/ApiClient.cs b/src/GitHub.Api/Application/ApiClient.cs index c4ae1782d..9783078d4 100644 --- a/src/GitHub.Api/Application/ApiClient.cs +++ b/src/GitHub.Api/Application/ApiClient.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading; using System.Threading.Tasks; using Octokit; @@ -27,14 +26,10 @@ public static IApiClient Create(UriString repositoryUrl, IKeychain keychain) private readonly IKeychain keychain; private readonly IGitHubClient githubClient; private readonly ILoginManager loginManager; - private static readonly SemaphoreSlim sem = new SemaphoreSlim(1); IList organizationsCache; Octokit.User userCache; - string owner; - bool? isEnterprise; - public ApiClient(UriString hostUrl, IKeychain keychain, IGitHubClient githubClient) { Guard.ArgumentNotNull(hostUrl, nameof(hostUrl)); From f9e7948084b06df2ac1fb29fe40ff26d844e0395 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:20:29 -0400 Subject: [PATCH 09/32] Removing unused variables from HistoryView --- .../Assets/Editor/GitHub.Unity/UI/HistoryView.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs index f5b5f2fc9..62b0f8ad5 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs @@ -473,7 +473,6 @@ private void RevertCommit() private bool HistoryEntry(GitLogEntry entry, LogEntryState state, bool selected) { var entryRect = GUILayoutUtility.GetRect(Styles.HistoryEntryHeight, Styles.HistoryEntryHeight); - var timelineBarRect = new Rect(entryRect.x + Styles.BaseSpacing, 0, 2, Styles.HistoryDetailsHeight); if (Event.current.type == EventType.Repaint) { @@ -481,7 +480,6 @@ private bool HistoryEntry(GitLogEntry entry, LogEntryState state, bool selected) var summaryRect = new Rect(entryRect.x, entryRect.y + (Styles.BaseSpacing / 2), entryRect.width, Styles.HistorySummaryHeight + Styles.BaseSpacing); var timestampRect = new Rect(entryRect.x, entryRect.yMax - Styles.HistoryDetailsHeight - (Styles.BaseSpacing / 2), entryRect.width, Styles.HistoryDetailsHeight); - var authorRect = new Rect(timestampRect.xMax, timestampRect.y, timestampRect.width, timestampRect.height); var contentOffset = new Vector2(Styles.BaseSpacing * 2, 0); @@ -630,7 +628,6 @@ private void Push() private void Fetch() { - var remote = Repository.CurrentRemote.HasValue ? Repository.CurrentRemote.Value.Name : String.Empty; Repository .Fetch() .FinallyInUI((success, e) => { From 46ca301913e2c2ac22e5e0013d5d2686e5aff1de Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:21:17 -0400 Subject: [PATCH 10/32] Removing unused fields from SettingsView --- .../Assets/Editor/GitHub.Unity/UI/SettingsView.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs index 6bec1cb99..8d212ca9e 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs @@ -11,7 +11,6 @@ namespace GitHub.Unity [Serializable] class SettingsView : Subview { - private const string GitInstallTitle = "Git installation"; private const string GitRepositoryTitle = "Repository Configuration"; private const string GitRepositoryRemoteLabel = "Remote"; private const string GitRepositorySave = "Save Repository"; @@ -20,9 +19,6 @@ class SettingsView : Subview private const string EnableTraceLoggingLabel = "Enable Trace Logging"; private const string MetricsOptInLabel = "Help us improve by sending anonymous usage data"; private const string DefaultRepositoryRemoteName = "origin"; - private const string BrowseButton = "..."; - private const string PathToGit = "Path to Git"; - private const string GitPathSaveButton = "Save Path"; [NonSerialized] private int newGitIgnoreRulesSelection = -1; [NonSerialized] private bool isBusy; From 4b73234e98c65b7fa6f0d6d09b9ccba1247942e1 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:22:02 -0400 Subject: [PATCH 11/32] Removing unused fields from SettingsView --- .../Assets/Editor/GitHub.Unity/UI/SettingsView.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs index 8d212ca9e..731fe401b 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs @@ -20,11 +20,8 @@ class SettingsView : Subview private const string MetricsOptInLabel = "Help us improve by sending anonymous usage data"; private const string DefaultRepositoryRemoteName = "origin"; - [NonSerialized] private int newGitIgnoreRulesSelection = -1; [NonSerialized] private bool isBusy; - [SerializeField] private int gitIgnoreRulesSelection = 0; - [SerializeField] private string initDirectory; [SerializeField] private List lockedFiles = new List(); [SerializeField] private Vector2 lockScrollPos; [SerializeField] private string repositoryRemoteName; @@ -35,16 +32,12 @@ class SettingsView : Subview [NonSerialized] private bool remoteHasChanged; [NonSerialized] private bool locksHaveChanged; - [SerializeField] private string newGitName; - [SerializeField] private string newGitEmail; [SerializeField] private string newRepositoryRemoteUrl; - [SerializeField] private User cachedUser; [SerializeField] private bool metricsEnabled; [NonSerialized] private bool metricsHasChanged; [SerializeField] private GitPathView gitPathView = new GitPathView(); - [SerializeField] private UserSettingsView userSettingsView = new UserSettingsView(); public override void InitializeView(IView parent) From e68735f29139a72640eec0ff6ec2b89933b35070 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:22:47 -0400 Subject: [PATCH 12/32] Removing unused data from InitProjectView --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index c8ee372a3..45967dd9e 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -16,13 +16,6 @@ class InitProjectView : Subview private const string NoRepoDescription = "Initialize a Git repository to track changes and collaborate with others."; [SerializeField] private bool isBusy; - [SerializeField] private bool isPublished; - - public override void OnDataUpdate() - { - base.OnDataUpdate(); - MaybeUpdateData(); - } public override void OnRepositoryChanged(IRepository oldRepository) { @@ -90,11 +83,6 @@ public override void OnGUI() GUILayout.EndVertical(); } - private void MaybeUpdateData() - { - isPublished = Repository != null && Repository.CurrentRemote.HasValue; - } - public override bool IsBusy { get { return isBusy; } From bc15e774c8dd1a154122e6abf15c05548610703b Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:24:18 -0400 Subject: [PATCH 13/32] Removing unused timelineBarColor from Styles --- .../Assets/Editor/GitHub.Unity/Misc/Styles.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs index a4c57790a..27c0e37ec 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs @@ -97,8 +97,6 @@ class Styles lockIcon, dropdownListIcon; - private static Color timelineBarColor; - public static Texture2D GetFileStatusIcon(GitFileStatus status, bool isLocked) { if (isLocked) @@ -597,18 +595,6 @@ public static GUIStyle GenericBoxStyle } } - public static Color TimelineBarColor - { - get - { - if (timelineBarColor == null) - { - timelineBarColor = new Color(0.51F, 0.51F, 0.51F, 0.2F); - } - return timelineBarColor; - } - } - public static Texture2D ActiveBranchIcon { get From 44a843f0981c0fd039de57b64d17d14c2f489b66 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:27:31 -0400 Subject: [PATCH 14/32] Removing unused variable and fixing missing BeginHorizontal in Window --- src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs index a9bbaca1b..f9a32fa25 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs @@ -283,7 +283,7 @@ private void DoHeaderGUI() private void DoToolbarGUI() { // Subtabs & toolbar - Rect mainNavRect = EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); + GUILayout.BeginHorizontal(EditorStyles.toolbar); { changeTab = activeTab; EditorGUI.BeginChangeCheck(); From 7b003ed43f54c63351048d6e5a111598baea7e56 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:28:12 -0400 Subject: [PATCH 15/32] Removing unused field in HistoryView --- src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs index 62b0f8ad5..cc498db17 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs @@ -37,7 +37,6 @@ class HistoryView : Subview [NonSerialized] private int historyStartIndex; [NonSerialized] private int historyStopIndex; - [NonSerialized] private float lastWidth; [NonSerialized] private int listID; [NonSerialized] private int newSelectionIndex; [NonSerialized] private float scrollOffset; From 2cc492060ea250300d1210a16ba7a672b24810b5 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:28:55 -0400 Subject: [PATCH 16/32] Removing unused field in ApplicationCache --- .../Assets/Editor/GitHub.Unity/ApplicationCache.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs index c18c19d51..5200df7ec 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs @@ -38,7 +38,6 @@ sealed class EnvironmentCache : ScriptObjectSingleton [SerializeField] private string unityApplication; [SerializeField] private string unityAssetsPath; [SerializeField] private string extensionInstallPath; - [SerializeField] private string gitExecutablePath; [SerializeField] private string unityVersion; [NonSerialized] private IEnvironment environment; @@ -80,7 +79,6 @@ public void Flush() unityApplication = Environment.UnityApplication; unityAssetsPath = Environment.UnityAssetsPath; extensionInstallPath = Environment.ExtensionInstallPath; - gitExecutablePath = Environment.GitExecutablePath; Save(true); } } From bef2444d75686029558b15abc33c6e04924ba243 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:34:04 -0400 Subject: [PATCH 17/32] Fixing build error --- src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs index cc498db17..c93f96989 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs @@ -62,7 +62,6 @@ public override void InitializeView(IView parent) { base.InitializeView(parent); - lastWidth = Position.width; selectionIndex = newSelectionIndex = -1; changesetTree.InitializeView(this); From b6daa32e1547dec25660e14596fd0c45c0b27159 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:34:50 -0400 Subject: [PATCH 18/32] Removing unused field from BaseWindow --- src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BaseWindow.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BaseWindow.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BaseWindow.cs index 03ce9534c..c864652c5 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BaseWindow.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BaseWindow.cs @@ -7,7 +7,6 @@ namespace GitHub.Unity abstract class BaseWindow : EditorWindow, IView { [NonSerialized] private bool initialized = false; - [NonSerialized] private IApplicationManager cachedManager; [NonSerialized] private IRepository cachedRepository; [NonSerialized] private bool initializeWasCalled; [NonSerialized] private bool inLayout; From 161ee170048d9e015d868acfaaec8bba6304c97a Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:35:34 -0400 Subject: [PATCH 19/32] Removing unused Logger --- .../Threading/SingleThreadSynchronizationContext.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/Threading/SingleThreadSynchronizationContext.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/Threading/SingleThreadSynchronizationContext.cs index 5db0285d9..a4dfe6038 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/Threading/SingleThreadSynchronizationContext.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/Threading/SingleThreadSynchronizationContext.cs @@ -1,4 +1,3 @@ -using GitHub.Unity; using System; using System.Threading; using UnityEditor; @@ -7,8 +6,6 @@ namespace GitHub.Unity { class MainThreadSynchronizationContext : SynchronizationContext, IMainThreadSynchronizationContext { - private static readonly ILogging logger = Logging.GetLogger(); - public void Schedule(Action action) { Guard.ArgumentNotNull(action, "action"); From 0221b7225ebc1b5899568a7ddd6f011f21a39bd9 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:36:01 -0400 Subject: [PATCH 20/32] Removing unused field from Styles --- src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs index 27c0e37ec..0e282ee88 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs @@ -49,8 +49,6 @@ class Styles private const string WarningLabel = "Warning: {0}"; - private static Color headerGreyColor = new Color(0.878f, 0.878f, 0.878f, 1.0f); - private static GUIStyle label, boldLabel, errorLabel, From 97a2ddd6380b17ebab29494fd0f8dd1762085222 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:39:10 -0400 Subject: [PATCH 21/32] Removing several unused fields from TaskSystem.Tests --- src/tests/TaskSystemIntegrationTests/Tests.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/tests/TaskSystemIntegrationTests/Tests.cs b/src/tests/TaskSystemIntegrationTests/Tests.cs index 97647db89..aef181f95 100644 --- a/src/tests/TaskSystemIntegrationTests/Tests.cs +++ b/src/tests/TaskSystemIntegrationTests/Tests.cs @@ -266,7 +266,6 @@ public async void NonUITasksAlwaysRunOnDifferentThreadFromUITasks() var output = new Dictionary(); var tasks = new List(); var seed = Randomizer.RandomSeed; - var rand = new Randomizer(seed); var uiThread = 0; await new ActionTask(Token, _ => uiThread = Thread.CurrentThread.ManagedThreadId) { Affinity = TaskAffinity.UI } @@ -290,7 +289,6 @@ public async void ChainingOnDifferentSchedulers() var output = new Dictionary>(); var tasks = new List(); var seed = Randomizer.RandomSeed; - var rand = new Randomizer(seed); var uiThread = 0; await new ActionTask(Token, _ => uiThread = Thread.CurrentThread.ManagedThreadId) { Affinity = TaskAffinity.UI } @@ -567,7 +565,6 @@ public async Task StartAndEndAreAlwaysRaised() [ExpectedException(typeof(InvalidOperationException))] public async Task ExceptionPropagatesOutIfNoFinally() { - var runOrder = new List(); var task = new ActionTask(Token, _ => { throw new InvalidOperationException(); }) .Catch(_ => { }); await task.StartAsAsync(); @@ -578,9 +575,8 @@ public async Task ExceptionPropagatesOutIfNoFinally() [ExpectedException(typeof(InvalidOperationException))] public async Task DeferExceptions() { - var runOrder = new List(); var task = new FuncTask(Token, _ => 1) - .Defer(async d => + .Defer(async d => { throw new InvalidOperationException(); return await TaskEx.FromResult(d); @@ -592,7 +588,6 @@ public async Task DeferExceptions() [Test] public async Task StartAsyncWorks() { - var runOrder = new List(); var task = new FuncTask(Token, _ => 1); var ret = await task.StartAsAsync(); Assert.AreEqual(1, ret); @@ -643,7 +638,6 @@ public async Task ContinueAfterException() [Test] public async Task StartAwaitSafelyAwaits() { - var runOrder = new List(); var task = new ActionTask(Token, _ => { throw new InvalidOperationException(); }) .Catch(_ => { }); await task.StartAwait(_ => { }); @@ -702,7 +696,6 @@ public async Task AlwaysChainAsyncBodiesWithNonAsync() }), TaskAffinity.Concurrent) .Finally((_, e, v) => v); ; - var ret = await act.StartAsAsync(); CollectionAssert.AreEqual(Enumerable.Range(1, 7), runOrder); } @@ -758,7 +751,6 @@ public async Task DoNotEndChainsWithDefer() return v; }), TaskAffinity.Concurrent); ; - var ret = await act.Start().Task; // the last one hasn't finished before await is done CollectionAssert.AreEqual(Enumerable.Range(1, 6), runOrder); } From b87d2c2324f195c677b78da0798a54d37f0d9d50 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:42:34 -0400 Subject: [PATCH 22/32] Removing enivronment from GitCredentialManager --- src/GitHub.Api/Git/GitCredentialManager.cs | 4 +--- src/GitHub.Api/Platform/Platform.cs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/GitHub.Api/Git/GitCredentialManager.cs b/src/GitHub.Api/Git/GitCredentialManager.cs index 4922d7a26..fceeec221 100644 --- a/src/GitHub.Api/Git/GitCredentialManager.cs +++ b/src/GitHub.Api/Git/GitCredentialManager.cs @@ -11,14 +11,12 @@ class GitCredentialManager : ICredentialManager private ICredential credential; private string credHelper = null; - private readonly IEnvironment environment; private readonly IProcessManager processManager; private readonly ITaskManager taskManager; - public GitCredentialManager(IEnvironment environment, IProcessManager processManager, + public GitCredentialManager(IProcessManager processManager, ITaskManager taskManager) { - this.environment = environment; this.processManager = processManager; this.taskManager = taskManager; } diff --git a/src/GitHub.Api/Platform/Platform.cs b/src/GitHub.Api/Platform/Platform.cs index 6e4a20e4e..71456a5a5 100644 --- a/src/GitHub.Api/Platform/Platform.cs +++ b/src/GitHub.Api/Platform/Platform.cs @@ -26,7 +26,7 @@ public IPlatform Initialize(IProcessManager processManager, ITaskManager taskMan if (CredentialManager == null) { - CredentialManager = new GitCredentialManager(Environment, processManager, taskManager); + CredentialManager = new GitCredentialManager(processManager, taskManager); Keychain = new Keychain(Environment, CredentialManager); Keychain.Initialize(); } From 596522b989cc50de213620b546222695bacfac09 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:42:44 -0400 Subject: [PATCH 23/32] Removing unused test --- src/tests/TaskSystemIntegrationTests/Tests.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/tests/TaskSystemIntegrationTests/Tests.cs b/src/tests/TaskSystemIntegrationTests/Tests.cs index aef181f95..091c87037 100644 --- a/src/tests/TaskSystemIntegrationTests/Tests.cs +++ b/src/tests/TaskSystemIntegrationTests/Tests.cs @@ -570,21 +570,6 @@ public async Task ExceptionPropagatesOutIfNoFinally() await task.StartAsAsync(); } - //[Test] - //[Ignore("borked")] - [ExpectedException(typeof(InvalidOperationException))] - public async Task DeferExceptions() - { - var task = new FuncTask(Token, _ => 1) - .Defer(async d => - { - throw new InvalidOperationException(); - return await TaskEx.FromResult(d); - }) - .Then(_ => { }); - await task.StartAsAsync(); - } - [Test] public async Task StartAsyncWorks() { From 93a3aaa413287aae02c64198282ee634e88776b2 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:43:44 -0400 Subject: [PATCH 24/32] Removing unused variables --- src/tests/UnitTests/Extensions/EnvironmentExtensionTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/UnitTests/Extensions/EnvironmentExtensionTests.cs b/src/tests/UnitTests/Extensions/EnvironmentExtensionTests.cs index d3ef863b7..bd6e4aa11 100644 --- a/src/tests/UnitTests/Extensions/EnvironmentExtensionTests.cs +++ b/src/tests/UnitTests/Extensions/EnvironmentExtensionTests.cs @@ -53,7 +53,7 @@ public void GetRepositoryPathThrowsWhenRepositoryIsChildOfProject( environment.RepositoryPath.Returns(repositoryPath.ToNPath()); environment.UnityProjectPath.Returns(projectPath.ToNPath()); - var repositoryFilePath = environment.GetRepositoryPath(path.ToNPath()); + environment.GetRepositoryPath(path.ToNPath()); } [Test, Sequential] @@ -83,7 +83,7 @@ public void GetAssetPathShouldThrowWhenRepositoryRootIsChild( environment.RepositoryPath.Returns(repositoryPath.ToNPath()); environment.UnityProjectPath.Returns(projectPath.ToNPath()); - var repositoryFilePath = environment.GetAssetPath(path.ToNPath()); + environment.GetAssetPath(path.ToNPath()); } } } \ No newline at end of file From b2829a7dac823b15b4fa3a34ff1f180ff3c09828 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:44:30 -0400 Subject: [PATCH 25/32] Removing unused local variables --- src/tests/UnitTests/IO/GitStatusEntryFactoryTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/UnitTests/IO/GitStatusEntryFactoryTests.cs b/src/tests/UnitTests/IO/GitStatusEntryFactoryTests.cs index eec8473fe..78fe0482b 100644 --- a/src/tests/UnitTests/IO/GitStatusEntryFactoryTests.cs +++ b/src/tests/UnitTests/IO/GitStatusEntryFactoryTests.cs @@ -23,7 +23,7 @@ public void CreateObjectWhenProjectRootIsChildOfGitRootAndFileInGitRoot() var repositoryPath = "/Source".ToNPath(); var unityProjectPath = repositoryPath.Combine("UnityProject"); - var gitEnvironment = SubstituteFactory.CreateProcessEnvironment(repositoryPath); + SubstituteFactory.CreateProcessEnvironment(repositoryPath); var environment = SubstituteFactory.CreateEnvironment(new CreateEnvironmentOptions { RepositoryPath = repositoryPath, UnityProjectPath = unityProjectPath @@ -54,7 +54,7 @@ public void CreateObjectWhenProjectRootIsChildOfGitRootAndFileInProjectRoot() var repositoryPath = "/Source".ToNPath(); var unityProjectPath = repositoryPath.Combine("UnityProject"); - var gitEnvironment = SubstituteFactory.CreateProcessEnvironment(repositoryPath); + SubstituteFactory.CreateProcessEnvironment(repositoryPath); var environment = SubstituteFactory.CreateEnvironment(new CreateEnvironmentOptions { RepositoryPath = repositoryPath, UnityProjectPath = unityProjectPath @@ -84,7 +84,7 @@ public void CreateObjectWhenProjectRootIsSameAsGitRootAndFileInGitRoot() var repositoryPath = "/Source".ToNPath(); var unityProjectPath = repositoryPath; - var gitEnvironment = SubstituteFactory.CreateProcessEnvironment(repositoryPath); + SubstituteFactory.CreateProcessEnvironment(repositoryPath); var environment = SubstituteFactory.CreateEnvironment(new CreateEnvironmentOptions { RepositoryPath = repositoryPath, UnityProjectPath = unityProjectPath From 23052dd276cb5e322b7726f07e13609958191833 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:45:29 -0400 Subject: [PATCH 26/32] Removing unused field from SimpleJson --- src/GitHub.Api/Helpers/SimpleJson.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GitHub.Api/Helpers/SimpleJson.cs b/src/GitHub.Api/Helpers/SimpleJson.cs index da3325c28..dd2cf8483 100644 --- a/src/GitHub.Api/Helpers/SimpleJson.cs +++ b/src/GitHub.Api/Helpers/SimpleJson.cs @@ -517,7 +517,6 @@ static class SimpleJson private static readonly char[] EscapeTable; private static readonly char[] EscapeCharacters = new char[] { '"', '\\', '\b', '\f', '\n', '\r', '\t' }; - private static readonly string EscapeCharactersString = new string(EscapeCharacters); static SimpleJson() { From 7af8e7f90c6177ac4b2c492a9f4affa067ee21db Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:46:13 -0400 Subject: [PATCH 27/32] Removing more commented out tests --- src/tests/TaskSystemIntegrationTests/Tests.cs | 98 ------------------- 1 file changed, 98 deletions(-) diff --git a/src/tests/TaskSystemIntegrationTests/Tests.cs b/src/tests/TaskSystemIntegrationTests/Tests.cs index 091c87037..d916283ff 100644 --- a/src/tests/TaskSystemIntegrationTests/Tests.cs +++ b/src/tests/TaskSystemIntegrationTests/Tests.cs @@ -642,104 +642,6 @@ public async Task CanWrapATask() CollectionAssert.AreEqual(new string[] { $"ran" }, runOrder); } - /// - /// Always call Then or another non-Defer variant after calling Defer - /// - //[Test] - //[Ignore("borked")] - public async Task AlwaysChainAsyncBodiesWithNonAsync() - { - var runOrder = new List(); - var act = new FuncTask>(Token, _ => runOrder) { Name = "First" } - .Defer(GetData) - .Then((_, v) => - { - v.Add(2); - return v; - }) - .Defer(GetData2) - .Then((_, v) => - { - v.Add(4); - return v; - }) - .Defer(async v => - { - await TaskEx.Delay(10); - v.Add(5); - return v; - }) - .Then((_, v) => - { - v.Add(6); - return v; - }) - .Defer(v => new Task>(() => - { - v.Add(7); - return v; - }), TaskAffinity.Concurrent) - .Finally((_, e, v) => v); - ; - CollectionAssert.AreEqual(Enumerable.Range(1, 7), runOrder); - } - - /// - /// Always call Then or another non-Defer variant after calling Defer - /// - //[Test] - //[Ignore("borked")] - public async Task TwoDefersInARowWillNotWork() - { - var runOrder = new List(); - var act = new FuncTask>(Token, _ => runOrder) { Name = "First" } - .Defer(GetData) - .Defer(GetData2) - .Finally((_, e, v) => v); - ; - var ret = await act.StartAsAsync(); - Assert.IsNull(ret); - } - - //[Test] - //[Ignore("borked")] - public async Task DoNotEndChainsWithDefer() - { - var runOrder = new List(); - var act = new FuncTask>(Token, _ => runOrder) { Name = "First" } - .Defer(GetData) - .Then((_, v) => - { - v.Add(2); - return v; - }) - .Defer(GetData2) - .Then((_, v) => - { - v.Add(4); - return v; - }) - .Defer(async v => - { - await TaskEx.Delay(10); - v.Add(5); - return v; - }) - .Then((_, v) => - { - v.Add(6); - return v; - }) - .Defer(v => new Task>(() => - { - v.Add(7); - return v; - }), TaskAffinity.Concurrent); - ; - // the last one hasn't finished before await is done - CollectionAssert.AreEqual(Enumerable.Range(1, 6), runOrder); - } - private async Task> GetData(List v) { await TaskEx.Delay(10); From 8e2495294a83e29237fbba97db5873913bb6948d Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:47:37 -0400 Subject: [PATCH 28/32] Some UnitTest cleanup --- .../IO/LinuxBasedGitEnvironmentTests.cs | 25 ------------------- .../IO/MacBasedGitEnvironmentTests.cs | 25 ------------------- .../IO/WindowsGitEnvironmentTests.cs | 17 ------------- 3 files changed, 67 deletions(-) diff --git a/src/tests/UnitTests/IO/LinuxBasedGitEnvironmentTests.cs b/src/tests/UnitTests/IO/LinuxBasedGitEnvironmentTests.cs index aaacd02c6..f7d123c24 100644 --- a/src/tests/UnitTests/IO/LinuxBasedGitEnvironmentTests.cs +++ b/src/tests/UnitTests/IO/LinuxBasedGitEnvironmentTests.cs @@ -10,29 +10,6 @@ namespace UnitTests [TestFixture] public class LinuxGitEnvironmentTests: GitEnvironmentTestsBase { - //public static IEnumerable GetDefaultGitPath_TestCases() - //{ - // var testCase = new TestCaseData(true, LinuxGitEnvironment.DefaultGitPath); - // testCase.SetName("Should be found"); - // yield return testCase; - - // testCase = new TestCaseData(false, null); - // testCase.SetName("Should be null"); - // yield return testCase; - //} - - //[TestCaseSource(nameof(GetDefaultGitPath_TestCases))] - //public void GetDefaultGitPath(bool fileFound, string filePath) - //{ - // var environment = Substitute.For(); - - // var filesystem = Substitute.For(); - // filesystem.FileExists(Args.String).Returns(fileFound); - - // var linuxBasedGitInstallationStrategy = new LinuxGitEnvironment(environment, filesystem); - // linuxBasedGitInstallationStrategy.FindGitInstallationPath(TODO).Should().Be(filePath); - //} - public static IEnumerable ValidateGitPath_TestCases() { var testCase = new TestCaseData(true, true); @@ -47,8 +24,6 @@ public static IEnumerable ValidateGitPath_TestCases() [TestCaseSource(nameof(ValidateGitPath_TestCases))] public void ValidateGitPath(bool inFileSystem, bool found) { - var environment = Substitute.For(); - var filesystem = Substitute.For(); filesystem.FileExists(Args.String).Returns(inFileSystem); diff --git a/src/tests/UnitTests/IO/MacBasedGitEnvironmentTests.cs b/src/tests/UnitTests/IO/MacBasedGitEnvironmentTests.cs index 87a8827a3..959e65e37 100644 --- a/src/tests/UnitTests/IO/MacBasedGitEnvironmentTests.cs +++ b/src/tests/UnitTests/IO/MacBasedGitEnvironmentTests.cs @@ -10,29 +10,6 @@ namespace UnitTests [TestFixture] public class MacGitEnvironmentTests { - //public static IEnumerable GetDefaultGitPath_TestCases() - //{ - // var testCase = new TestCaseData(true, MacGitEnvironment.DefaultGitPath); - // testCase.SetName("Should be found"); - // yield return testCase; - - // testCase = new TestCaseData(false, null); - // testCase.SetName("Should be null"); - // yield return testCase; - //} - - //[TestCaseSource(nameof(GetDefaultGitPath_TestCases))] - //public void GetDefaultGitPath(bool fileFound, string filePath) - //{ - // var environment = Substitute.For(); - - // var filesystem = Substitute.For(); - // filesystem.FileExists(Args.String).Returns(fileFound); - - // var linuxBasedGitInstallationStrategy = new MacGitEnvironment(environment, filesystem); - // linuxBasedGitInstallationStrategy.FindGitInstallationPath(TODO).Should().Be(filePath); - //} - public static IEnumerable ValidateGitPath_TestCases() { var testCase = new TestCaseData(true, true); @@ -47,8 +24,6 @@ public static IEnumerable ValidateGitPath_TestCases() [TestCaseSource(nameof(ValidateGitPath_TestCases))] public void ValidateGitPath(bool inFileSystem, bool found) { - var environment = Substitute.For(); - var filesystem = Substitute.For(); filesystem.FileExists(Args.String).Returns(inFileSystem); diff --git a/src/tests/UnitTests/IO/WindowsGitEnvironmentTests.cs b/src/tests/UnitTests/IO/WindowsGitEnvironmentTests.cs index 05be9b4fe..29f036638 100644 --- a/src/tests/UnitTests/IO/WindowsGitEnvironmentTests.cs +++ b/src/tests/UnitTests/IO/WindowsGitEnvironmentTests.cs @@ -48,21 +48,6 @@ public static IEnumerable GetDefaultGitPath_TestCases() yield return testCase; } - //[TestCaseSource(nameof(GetDefaultGitPath_TestCases))] - //public void GetDefaultGitPath(string localAppDataPath, string gitHubRootPath, string[] gitHubRootPathChildren, string gitExecutablePath) - //{ - // var environment = Substitute.For(); - // environment.GetSpecialFolder(Arg.Is(Environment.SpecialFolder.LocalApplicationData)) - // .Returns(localAppDataPath); - - // var filesystem = Substitute.For(); - // filesystem.GetDirectories(gitHubRootPath) - // .Returns(gitHubRootPathChildren); - - // var windowsGitInstallationStrategy = new WindowsGitEnvironment(environment, filesystem); - // windowsGitInstallationStrategy.FindGitInstallationPath(TODO).Should().Be(gitExecutablePath); - //} - public static IEnumerable ValidateGitPath_TestCases() { var testCase = new TestCaseData(true, true); @@ -77,8 +62,6 @@ public static IEnumerable ValidateGitPath_TestCases() [TestCaseSource(nameof(ValidateGitPath_TestCases))] public void ValidateGitPath(bool inFileSystem, bool found) { - var environment = Substitute.For(); - var filesystem = Substitute.For(); filesystem.FileExists(Args.String).Returns(inFileSystem); From 84b6459dc440bc655132c747e846354e31ea66c7 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:48:06 -0400 Subject: [PATCH 29/32] Removing unused variable --- src/tests/IntegrationTests/BaseGitEnvironmentTest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs b/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs index d0bd107f6..5bbec9fd9 100644 --- a/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs +++ b/src/tests/IntegrationTests/BaseGitEnvironmentTest.cs @@ -28,8 +28,6 @@ protected async Task Initialize(NPath repoPath, NPath environmentP GitClient = new GitClient(Environment, ProcessManager, TaskManager); - var usageTracker = new NullUsageTracker(); - RepositoryManager = GitHub.Unity.RepositoryManager.CreateInstance(Platform, TaskManager, GitClient, repoPath); RepositoryManager.Initialize(); From 88879b4965da8329f128ec5be30764ef2a3cf6f5 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:48:23 -0400 Subject: [PATCH 30/32] Removing unused logger --- src/tests/UnitTests/UI/TreeBuilderTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/tests/UnitTests/UI/TreeBuilderTests.cs b/src/tests/UnitTests/UI/TreeBuilderTests.cs index 6cb21977f..4a3594564 100644 --- a/src/tests/UnitTests/UI/TreeBuilderTests.cs +++ b/src/tests/UnitTests/UI/TreeBuilderTests.cs @@ -13,8 +13,6 @@ namespace UnitTests.UI [TestFixture, Isolated] public class TreeBuilderTests { - private ILogging logger = Logging.GetLogger(); - private IEnvironment environment; private GitObjectFactory gitObjectFactory; From 0c218a94519448766e7cba1376cb2be29edf858c Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:50:43 -0400 Subject: [PATCH 31/32] Minor test cleanup --- .../IntegrationTests/Process/ProcessManagerIntegrationTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs b/src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs index ed50875a8..8766b3798 100644 --- a/src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs +++ b/src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs @@ -175,8 +175,7 @@ public async Task CredentialHelperGetTest() { await Initialize(TestRepoMasterCleanSynchronized); - string s = null; - s = await ProcessManager + await ProcessManager .GetGitCreds(TestRepoMasterCleanSynchronized, Environment, GitEnvironment) .StartAsAsync(); } From ac50823e65dc6550af1b377566fe697ab8888c9b Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 19 Oct 2017 10:51:51 -0400 Subject: [PATCH 32/32] Removing unused variables in ThreadSynchronizationContext classes --- src/tests/IntegrationTests/ThreadSynchronizationContext.cs | 1 - .../TaskSystemIntegrationTests/ThreadSynchronizationContext.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/tests/IntegrationTests/ThreadSynchronizationContext.cs b/src/tests/IntegrationTests/ThreadSynchronizationContext.cs index bb7e4925d..7e92bf06a 100644 --- a/src/tests/IntegrationTests/ThreadSynchronizationContext.cs +++ b/src/tests/IntegrationTests/ThreadSynchronizationContext.cs @@ -58,7 +58,6 @@ private void Start() while (!token.IsCancellationRequested) { var current = DateTime.Now.Ticks; - var elapsed = current - lastTime; count++; if (current - secondStart > TimeSpan.TicksPerMillisecond * 1000) { diff --git a/src/tests/TaskSystemIntegrationTests/ThreadSynchronizationContext.cs b/src/tests/TaskSystemIntegrationTests/ThreadSynchronizationContext.cs index 17e8d52cc..742d47c53 100644 --- a/src/tests/TaskSystemIntegrationTests/ThreadSynchronizationContext.cs +++ b/src/tests/TaskSystemIntegrationTests/ThreadSynchronizationContext.cs @@ -59,7 +59,6 @@ private void Start() while (!token.IsCancellationRequested) { var current = DateTime.Now.Ticks; - var elapsed = current - lastTime; count++; if (current - secondStart > TimeSpan.TicksPerMillisecond * 1000) {