From a2d248bb8362808121f6b6abfd316d83b65afa79 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Fri, 14 Oct 2016 18:21:17 +0200 Subject: [PATCH] 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: 12, fail: 2 - PY3: err: 11, fail: 2 --- git/test/test_diff.py | 3 ++- git/test/test_submodule.py | 2 +- git/util.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/git/test/test_diff.py b/git/test/test_diff.py index d34d84e39..d5f5b721b 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -25,6 +25,7 @@ NULL_TREE, ) import ddt +from git.cmd import Git @ddt.ddt @@ -56,7 +57,7 @@ def test_diff_with_staged_file(self, rw_dir): fp = os.path.join(rw_dir, 'hello.txt') with open(fp, 'w') as fs: fs.write("hello world") - r.git.add(fp) + r.git.add(Git.polish_url(fp)) r.git.commit(message="init") with open(fp, 'w') as fs: diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 9db4f9c90..da3049440 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -705,7 +705,7 @@ def test_git_submodules_and_add_sm_with_new_commit(self, rwdir): fp = osp.join(smm.working_tree_dir, 'empty-file') with open(fp, 'w'): pass - smm.git.add(fp) + smm.git.add(Git.polish_url(fp)) smm.git.commit(m="new file added") # submodules are retrieved from the current commit's tree, therefore we can't really get a new submodule diff --git a/git/util.py b/git/util.py index 9668f7b3f..992937fb5 100644 --- a/git/util.py +++ b/git/util.py @@ -264,6 +264,7 @@ def _cygexpath(drive, path): def cygpath(path): + """Use :meth:`git.cmd.Git.polish_url()` instead, that works on any environment.""" if not path.startswith(('/cygdrive', '//')): for regex, parser, recurse in _cygpath_parsers: match = regex.match(path)