소스 검색

Drop the restriction on having objects writeable for the mmap.

Git creates objects read only, so this would have been a problem in the wild,
and was annoying and unnecessary anyway.
James Westby 18 년 전
부모
커밋
5c6717d461
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      git/objects.py

+ 2 - 2
git/objects.py

@@ -123,9 +123,9 @@ class ShaFile(object):
   def from_file(cls, filename):
     """Get the contents of a SHA file on disk"""
     size = os.path.getsize(filename)
-    f = open(filename, 'rb+')
+    f = open(filename, 'rb')
     try:
-      map = mmap.mmap(f.fileno(), size)
+      map = mmap.mmap(f.fileno(), size, access=mmap.ACCESS_READ)
       shafile = cls._parse_file(map)
       shafile._parse_text()
       return shafile