Content-Length: 2061 | pFad | http://github.com/gitpython-developers/GitPython/pull/1778.patch
thub.com
From 6e4cee4fa708465cf714e36a9dc8b9b6b94acc0c Mon Sep 17 00:00:00 2001
From: Stefan Gmeiner
Date: Thu, 21 Dec 2023 21:33:37 +0100
Subject: [PATCH] Fix Items of type PathLike
---
git/index/base.py | 2 +-
test/test_index.py | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/git/index/base.py b/git/index/base.py
index 112ad3feb..cffb213a9 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -940,7 +940,7 @@ def _items_to_rela_paths(
for item in items:
if isinstance(item, (BaseIndexEntry, (Blob, Submodule))):
paths.append(self._to_relative_path(item.path))
- elif isinstance(item, str):
+ elif isinstance(item, (str, os.PathLike)):
paths.append(self._to_relative_path(item))
else:
raise TypeError("Invalid item type: %r" % item)
diff --git a/test/test_index.py b/test/test_index.py
index 6b746b8b4..50d941e83 100644
--- a/test/test_index.py
+++ b/test/test_index.py
@@ -558,14 +558,16 @@ def test_index_mutation(self, rw_repo):
def mixed_iterator():
count = 0
for entry in index.entries.values():
- type_id = count % 4
- if type_id == 0: # path
+ type_id = count % 5
+ if type_id == 0: # path (str)
yield entry.path
- elif type_id == 1: # blob
+ elif type_id == 1: # path (PathLike)
+ yield Path(entry.path)
+ elif type_id == 2: # blob
yield Blob(rw_repo, entry.binsha, entry.mode, entry.path)
- elif type_id == 2: # BaseIndexEntry
+ elif type_id == 3: # BaseIndexEntry
yield BaseIndexEntry(entry[:4])
- elif type_id == 3: # IndexEntry
+ elif type_id == 4: # IndexEntry
yield entry
else:
raise AssertionError("Invalid Type")
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/gitpython-developers/GitPython/pull/1778.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy