aboutsummaryrefslogtreecommitdiffstats
path: root/git_deps/detector.py
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2016-06-30 18:23:21 +0100
committerAdam Spiers <git@adamspiers.org>2018-05-15 13:42:16 +0100
commitd2bc634c373f86133b386af90eb931ee2ee59e02 (patch)
tree7023de4d2d1d7846fcb7132105dbee33102d6919 /git_deps/detector.py
parent4a5d64215075502e79d2a0b35c3a18a10d68c8fd (diff)
downloadgit-deps-d2bc634c373f86133b386af90eb931ee2ee59e02.tar.gz
move Repository instantiation to GitUtils
Diffstat (limited to 'git_deps/detector.py')
-rw-r--r--git_deps/detector.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/git_deps/detector.py b/git_deps/detector.py
index 3f51f0e..3cb8828 100644
--- a/git_deps/detector.py
+++ b/git_deps/detector.py
@@ -20,20 +20,17 @@ class DependencyDetector(object):
tree represented (conceptually) by a list of edges.
"""
- def __init__(self, options, repo_path=None, logger=None):
+ def __init__(self, options, repo=None, logger=None):
self.options = options
if logger is None:
self.logger = standard_logger(self.__class__.__name__,
options.debug)
- if repo_path is None:
- try:
- repo_path = pygit2.discover_repository('.')
- except KeyError:
- abort("Couldn't find a repository in the current directory.")
-
- self.repo = pygit2.Repository(repo_path)
+ if repo is None:
+ self.repo = GitUtils.get_repo()
+ else:
+ self.repo = repo
# Nested dict mapping dependents -> dependencies -> files
# causing that dependency -> numbers of lines within that file