Skip to content

Commit b2efa1b

Browse files
committed
cygwin, #533: FIX submodules detection (~10TCs fixed)
+ Decygpath sm's `.git` file contents. + Polish another path in `git add`; actually no main-code changes, just a replace \-->/ on a relative(!) path to make cygwin-git to work. - REGRESSION `test_git_submodules_and_add_sm_with_new_commit` asks for user/email settings. - Cygwin TCs failing: - PY2: err: 2, fail: 1 - PY3: err: 2, fail: 1
1 parent 4486bcb commit b2efa1b

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
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)

git/test/test_repo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def test_is_dirty_with_path(self, rwrepo):
310310
assert rwrepo.is_dirty(path="git") is True
311311
assert rwrepo.is_dirty(path="doc") is False
312312

313-
rwrepo.git.add(osp.join("git", "util.py"))
313+
rwrepo.git.add(Git.polish_url(osp.join("git", "util.py")))
314314
assert rwrepo.is_dirty(index=False, path="git") is False
315315
assert rwrepo.is_dirty(path="git") is True
316316

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