Make sure that GitRepositoryProvider.repositoryForDirectorySync() returns null rather than throws.

The UI locks up if this method does not return.
This commit is contained in:
Michael Bolin
2015-02-20 17:53:14 -08:00
parent 25befa7368
commit 6d24aaf497
2 changed files with 38 additions and 0 deletions

View File

@@ -51,6 +51,14 @@ class GitRepositoryProvider
# * {GitRepository} if the given directory has a Git repository.
# * `null` if the given directory does not have a Git repository.
repositoryForDirectorySync: (directory) ->
# Ensure that this method does not throw.
try
@repositoryForDirectorySyncInternal(directory)
catch e
# TODO: Log error.
null
repositoryForDirectorySyncInternal: (directory) ->
# Only one GitRepository should be created for each .git folder. Therefore,
# we must check directory and its parent directories to find the nearest
# .git folder.