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

Add using to avoid crash in Release mode #1311

Merged
merged 2 commits into from
Nov 10, 2017
Merged
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
10 changes: 7 additions & 3 deletions src/GitHub.App/Services/PullRequestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ public IObservable<IReadOnlyList<CommitMessage>> GetMessagesForUniqueCommits(

public IObservable<bool> IsWorkingDirectoryClean(ILocalRepositoryModel repository)
{
var repo = gitService.GetRepository(repository.LocalPath);
var isClean = !IsFilthy(repo.RetrieveStatus());
return Observable.Return(isClean);
// The `using` appears to resolve this issue:
// https://github.com/github/VisualStudio/issues/1306
using (var repo = gitService.GetRepository(repository.LocalPath))
{
var isClean = !IsFilthy(repo.RetrieveStatus());
return Observable.Return(isClean);
}
}

static bool IsFilthy(RepositoryStatus status)
Expand Down