Browse Source

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 years ago
parent
commit
5c6717d461
1 changed files with 2 additions and 2 deletions
  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