Skip to content

Commit 55b67e8

Browse files
committed
Fixed python < 2.6 windows specific issue when reading in the index using a memory map. Its totally ridiculous, but fixed
1 parent de3b963 commit 55b67e8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/git/index/base.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,13 @@ def _set_cache_(self, attr):
124124
return
125125
# END exception handling
126126

127-
stream = file_contents_ro(fd, stream=True, allow_mmap=True)
127+
# Here it comes: on windows in python 2.5, memory maps aren't closed properly
128+
# Hence we are in trouble if we try to delete a file that is memory mapped,
129+
# which happens during read-tree.
130+
# In this case, we will just read the memory in directly.
131+
# Its insanely bad ... I am disappointed !
132+
allow_mmap = (os.name != 'nt' or sys.version_info[1] > 5)
133+
stream = file_contents_ro(fd, stream=True, allow_mmap=allow_mmap)
128134

129135
try:
130136
self._deserialize(stream)

0 commit comments

Comments
 (0)