Skip to content

Commit 997ea34

Browse files
committed
cygwin, #533: FIX submodules detection (~10TCs fixed)
+ Decygpath sm's `.git` file contents. - Cygwin TCs failing: - PY2: err: 2, fail: 2 - PY3: err: 2, fail: 2
1 parent 4486bcb commit 997ea34

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

git/repo/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def __init__(self, path=None, odbt=DefaultDBType, search_parent_directories=Fals
109109
:raise InvalidGitRepositoryError:
110110
:raise NoSuchPathError:
111111
:return: git.Repo """
112-
if path and Git.is_cygwin():
112+
if Git.is_cygwin():
113113
path = decygpath(path)
114114

115115
epath = _expand_path(path or os.getcwd())

git/repo/fun.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
from git.exc import WorkTreeRepositoryUnsupported
77
from git.objects import Object
88
from git.refs import SymbolicReference
9-
from git.util import hex_to_bin, bin_to_hex
9+
from git.util import hex_to_bin, bin_to_hex, decygpath
1010
from gitdb.exc import (
1111
BadObject,
1212
BadName,
1313
)
1414

1515
import os.path as osp
16+
from git.cmd import Git
1617

1718

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy