summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setuptools_scm/git.py5
-rw-r--r--testing/test_regressions.py15
2 files changed, 18 insertions, 2 deletions
diff --git a/setuptools_scm/git.py b/setuptools_scm/git.py
index 40b0f77..6864f96 100644
--- a/setuptools_scm/git.py
+++ b/setuptools_scm/git.py
@@ -1,6 +1,6 @@
from .utils import do, do_ex, trace
from .version import meta
-from os.path import abspath, realpath
+from os.path import abspath, normcase, realpath
FILES_COMMAND = 'git ls-files'
@@ -12,7 +12,8 @@ def parse(root, describe_command=DEFAULT_DESCRIBE):
if ret:
return
trace('real root', real_root)
- if abspath(realpath(real_root)) != abspath(realpath(root)):
+ if (normcase(abspath(realpath(real_root))) !=
+ normcase(abspath(realpath(root)))):
return
rev_node, _, ret = do_ex('git rev-parse --verify --quiet HEAD', root)
if ret:
diff --git a/testing/test_regressions.py b/testing/test_regressions.py
index c123753..ac7ecfc 100644
--- a/testing/test_regressions.py
+++ b/testing/test_regressions.py
@@ -1,3 +1,7 @@
+import sys
+
+import pytest
+from setuptools_scm.git import parse
from setuptools_scm.utils import do_ex, do
@@ -43,3 +47,14 @@ setup(use_scm_version=vcfg)
res = do('python setup.py --version', p)
assert res == '1.0'
+
+
+@pytest.mark.skipif(sys.platform != 'win32',
+ reason="this bug is only valid on windows")
+def test_case_mismatch_on_windows_git(tmpdir):
+ """Case insensitive path checks on Windows"""
+ p = tmpdir.ensure("CapitalizedDir", dir=1)
+
+ do('git init', p)
+ res = parse(str(p).lower())
+ assert res is not None