MINGW-packages/mingw-w64-python-setuptools-git/0001-use-git-show-prefix.patch
Naveen M K e151c2940d
Add python-setuptools-git
Signed-off-by: Naveen M K <naveen@syrusdark.website>
2021-03-06 02:20:58 +05:30

24 lines
855 B
Diff

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)