From 3b1cfcc629e856b1384b811b8cf30b92a1e34fe1 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Fri, 14 Oct 2016 16:43:52 +0200 Subject: cygwin, #533: Allow '/cygdrive/c/' paths on repo init - Cygwin TCs failing: - PY2: err: 13, fail: 2 - PY3: err: 12, fail: 2 --- git/repo/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'git/repo') diff --git a/git/repo/base.py b/git/repo/base.py index 077ba4af..6355615e 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -35,7 +35,7 @@ from git.index import IndexFile from git.objects import Submodule, RootModule, Commit from git.refs import HEAD, Head, Reference, TagReference from git.remote import Remote, add_progress, to_progress_instance -from git.util import Actor, finalize_process +from git.util import Actor, finalize_process, decygpath from .fun import rev_parse, is_git_dir, find_git_dir, touch @@ -99,6 +99,8 @@ class Repo(object): repo = Repo("~/Development/git-python.git") repo = Repo("$REPOSITORIES/Development/git-python.git") + In *Cygwin*, path may be a `'cygdrive/...'` prefixed path. + :param odbt: Object DataBase type - a type which is constructed by providing the directory containing the database objects, i.e. .git/objects. It will @@ -111,6 +113,9 @@ class Repo(object): :raise InvalidGitRepositoryError: :raise NoSuchPathError: :return: git.Repo """ + if path and Git.is_cygwin(): + path = decygpath(path) + epath = _expand_path(path or os.getcwd()) self.git = None # should be set for __del__ not to fail in case we raise if not os.path.exists(epath): -- cgit v1.2.3