Skip to content

Commit

Permalink
Merge pull request #71 from andreiagaita/monitor-empty-dirs
Browse files Browse the repository at this point in the history
Fix browsing/monitoring non-git directories
  • Loading branch information
haacked committed Jan 5, 2015
2 parents 7261668 + 54a236a commit 355c35b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion SeeGitApp/Extensions/ModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static IObservable<FileSystemEventArgs> CreateGitRepositoryCreationObserv
e =>
e.ChangeType == WatcherChangeTypes.Created &&
e.FullPath.Equals(expectedGitDirectory, StringComparison.OrdinalIgnoreCase))
.Throttle(TimeSpan.FromSeconds(1));
.Take(1);
}

public static IObservable<FileSystemEventArgs> CreateGitRepositoryChangesObservable(string path)
Expand Down
28 changes: 14 additions & 14 deletions SeeGitApp/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,21 @@ private set
public void MonitorRepository(string repositoryWorkingPath)
{
if (repositoryWorkingPath == null) return;

string gitPath = ModelExtensions.GetGitRepositoryPath(repositoryWorkingPath);
if (!Directory.Exists(gitPath))
{
MonitorForRepositoryCreation(repositoryWorkingPath);
return;
}

RepositoryPath = repositoryWorkingPath;
string gitPath = ModelExtensions.GetGitRepositoryPath(repositoryWorkingPath);

_graphBuilder = _graphBuilderThunk(gitPath);
RepositoryPath = Directory.GetParent(gitPath).FullName;
Graph = _graphBuilder.Graph();
var graph = _graphBuilder.Graph();

if (_graph.VertexCount > 1)
_graph.LayoutAlgorithmType = "EfficientSugiyama";
Graph = Graph;
if (graph.VertexCount > 1)
graph.LayoutAlgorithmType = "EfficientSugiyama";
Graph = graph;

MonitorForRepositoryChanges(gitPath);
if (!Directory.Exists(gitPath))
MonitorForRepositoryCreation(RepositoryPath);
else
MonitorForRepositoryChanges(gitPath);
}

private void MonitorForRepositoryCreation(string repositoryWorkingPath)
Expand All @@ -92,7 +88,11 @@ private void MonitorForRepositoryChanges(string gitRepositoryPath)

public void Refresh()
{
Graph = _graphBuilder.Graph();
string gitPath = ModelExtensions.GetGitRepositoryPath(RepositoryPath);
if (!Directory.Exists(gitPath))
MonitorRepository(RepositoryPath);
else
Graph = _graphBuilder.Graph();
}

public bool ToggleSettings()
Expand Down

0 comments on commit 355c35b

Please sign in to comment.