diff --git a/setuptools_git/__init__.py b/setuptools_git/__init__.py index 24c9b8c..5a31b04 100644 --- a/setuptools_git/__init__.py +++ b/setuptools_git/__init__.py @@ -64,13 +64,17 @@ def gitlsfiles(dirname=''): try: topdir = check_output( - ['git', 'rev-parse', '--show-toplevel'], cwd=dirname or None, + ['git', 'rev-parse', '--show-prefix'], cwd=dirname or None, stderr=PIPE).strip() if sys.platform == 'win32': cwd = ntfsdecode(topdir) else: cwd = topdir + dirname = os.path.abspath(dirname) + cwd = cwd.strip()[:-1] # remove the trailing pathsep + assert dirname.replace("\\", "/").endswith(cwd) + cwd = dirname[: -len(cwd)] filenames = check_output( ['git', 'ls-files', '-z'], cwd=cwd, stderr=PIPE)