Skip to content

Commit

Permalink
Merge pull request #91 from te-je/master
Browse files Browse the repository at this point in the history
Case-insensitive path comparison for git on windows. Fixes #89
  • Loading branch information
RonnyPfannschmidt authored Jun 12, 2016
2 parents a575570 + e7c768a commit 4e82375
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 3 additions & 2 deletions setuptools_scm/git.py
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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:
Expand Down
15 changes: 15 additions & 0 deletions testing/test_regressions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import sys

import pytest
from setuptools_scm.git import parse
from setuptools_scm.utils import do_ex, do


Expand Down Expand Up @@ -43,3 +47,14 @@ def vs(v):

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

0 comments on commit 4e82375

Please sign in to comment.