Skip to content

Commit

Permalink
cygwin, gitpython-developers#533: FIX submodules detection (~10TCs fi…
Browse files Browse the repository at this point in the history
…xed)

+ Decygpath sm's `.git` file contents.

- Cygwin TCs failing:
  - PY2: err: 2, fail: 2
  - PY3: err: 2, fail: 2
  • Loading branch information
ankostis committed Oct 16, 2016
1 parent 4486bcb commit 997ea34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __init__(self, path=None, odbt=DefaultDBType, search_parent_directories=Fals
:raise InvalidGitRepositoryError:
:raise NoSuchPathError:
:return: git.Repo """
if path and Git.is_cygwin():
if Git.is_cygwin():
path = decygpath(path)

epath = _expand_path(path or os.getcwd())
Expand Down
6 changes: 5 additions & 1 deletion git/repo/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
from git.exc import WorkTreeRepositoryUnsupported
from git.objects import Object
from git.refs import SymbolicReference
from git.util import hex_to_bin, bin_to_hex
from git.util import hex_to_bin, bin_to_hex, decygpath
from gitdb.exc import (
BadObject,
BadName,
)

import os.path as osp
from git.cmd import Git


__all__ = ('rev_parse', 'is_git_dir', 'touch', 'find_git_dir', 'name_to_object', 'short_to_long', 'deref_tag',
Expand Down Expand Up @@ -59,6 +60,9 @@ def find_git_dir(d):
else:
if content.startswith('gitdir: '):
path = content[8:]
if Git.is_cygwin():
## Cygwin creates submodules prefixed with `/cygdrive/...` suffixes.
path = decygpath(path)
if not osp.isabs(path):
path = osp.join(osp.dirname(d), path)
return find_git_dir(path)
Expand Down

0 comments on commit 997ea34

Please sign in to comment.