def find_repository_searches_ancestors_for_working_directory(): with temporary_directory() as directory: repository_path = os.path.join(directory, ".git") search_path = os.path.join(directory, "one/two/three") mkdir_p(repository_path) mkdir_p(search_path) repository = find_repository(search_path) assert_equal(directory, repository.working_directory)
def find_repository_returns_git_repository_if_path_is_root_of_git_repository(): with temporary_directory() as directory: mkdir_p(os.path.join(directory, ".git")) repository = find_repository(directory) assert_equal("git", repository.type)
def find_repository_returns_none_if_there_is_no_repository(): with temporary_directory() as directory: assert_equal(None, find_repository(directory))