From 24a2be8af684885720ac376477fc864584e95bb2 Mon Sep 17 00:00:00 2001 From: tbeswick Date: Fri, 11 Oct 2019 16:44:45 +1300 Subject: [PATCH] Reverting `VersionControl.controls_location()` to pre PR state. Its an optimization that belongs in another PR. --- src/pip/_internal/vcs/versioncontrol.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/pip/_internal/vcs/versioncontrol.py b/src/pip/_internal/vcs/versioncontrol.py index 55afa908c19..9038ace8052 100644 --- a/src/pip/_internal/vcs/versioncontrol.py +++ b/src/pip/_internal/vcs/versioncontrol.py @@ -656,17 +656,10 @@ def controls_location(cls, location): # type: (str) -> bool """ Check if a location is controlled by the vcs. + It is meant to be overridden to implement smarter detection + mechanisms for specific vcs. - Searches up the filesystem and checks is_repository_directory(). - - It is meant to be extended to add smarter detection mechanisms for - specific vcs. For example, the Git override checks that Git is - actually available. + This can do more than is_repository_directory() alone. For example, + the Git override checks that Git is actually available. """ - while not cls.is_repository_directory(location): - last_location = location - location = os.path.dirname(location) - if location == last_location: - # We've traversed up to the root of the filesystem. - return False - return True + return cls.is_repository_directory(location)