Skip to content

Commit 5895270

Browse files
committed
cygwin, #533: polish abs-paths in git add commands
+ Modify TCs - no main-code changes. + FIXed: + `TestSubmodule.test_git_submodules_and_add_sm_with_new_commit()` + TestDiff.test_diff_with_staged_file() - Cygwin TCs failing: - PY2: err: 11, fail: 2 - PY3: err: 10, fail: 2
1 parent 3b1cfcc commit 5895270

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Diff for: git/test/test_diff.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
NULL_TREE,
2626
)
2727
import ddt
28+
from git.cmd import Git
2829

2930

3031
@ddt.ddt
@@ -56,7 +57,7 @@ def test_diff_with_staged_file(self, rw_dir):
5657
fp = os.path.join(rw_dir, 'hello.txt')
5758
with open(fp, 'w') as fs:
5859
fs.write("hello world")
59-
r.git.add(fp)
60+
r.git.add(Git.polish_url(fp))
6061
r.git.commit(message="init")
6162

6263
with open(fp, 'w') as fs:

Diff for: git/test/test_submodule.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ def test_git_submodules_and_add_sm_with_new_commit(self, rwdir):
705705
fp = osp.join(smm.working_tree_dir, 'empty-file')
706706
with open(fp, 'w'):
707707
pass
708-
smm.git.add(fp)
708+
smm.git.add(Git.polish_url(fp))
709709
smm.git.commit(m="new file added")
710710

711711
# submodules are retrieved from the current commit's tree, therefore we can't really get a new submodule

Diff for: git/util.py

+1
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ def _cygexpath(drive, path):
264264

265265

266266
def cygpath(path):
267+
"""Use :meth:`git.cmd.Git.polish_url()` instead, that works on any environment."""
267268
if not path.startswith(('/cygdrive', '//')):
268269
for regex, parser, recurse in _cygpath_parsers:
269270
match = regex.match(path)

0 commit comments

Comments
 (0)