Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 42d09fa

Browse files
committed
Avoid firing StatusChanged if we're not on a repo
1 parent 0f59f7e commit 42d09fa

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/GitHub.App/Services/TeamExplorerContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ async Task RefreshAsync()
127127
log.Debug("Fire StatusChanged event when PullRequest changes for ActiveRepository");
128128
StatusChanged?.Invoke(this, EventArgs.Empty);
129129
}
130-
else
130+
else if (newRepositoryPath != null)
131131
{
132-
log.Debug("Fire StatusChanged event when ***anything*** changes");
132+
log.Debug("Fire StatusChanged event when on a repository and anything changes");
133133
StatusChanged?.Invoke(this, EventArgs.Empty);
134134
}
135135

test/GitHub.App.UnitTests/Services/TeamExplorerContextTests.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,13 @@ public void NoActiveRepositoryChange_SolutionChanges()
151151

152152
public class TheStatusChangedEvent
153153
{
154-
[TestCase(true, false)]
155-
[TestCase(false, true)]
156-
public void AlwaysFireWhenNoLocalPathChange(bool changePath, bool expectWasRaised)
154+
[TestCase("path", "path", true)]
155+
[TestCase("path1", "path2", false)]
156+
[TestCase(null, null, false)]
157+
public void AlwaysFireWhenNoLocalPathChange(string path1, string path2, bool expectWasRaised)
157158
{
158159
var gitExt = CreateGitExt();
159160
var repositoryPaths = new[] { Directory.GetCurrentDirectory(), Path.GetTempPath() };
160-
var path1 = Directory.GetCurrentDirectory();
161-
var path2 = changePath ? Path.GetTempPath() : path1;
162161
var repoInfo1 = CreateRepositoryModel(path1);
163162
var repoInfo2 = CreateRepositoryModel(path2);
164163

0 commit comments

Comments
 (0)