summaryrefslogtreecommitdiff
path: root/git/refs/log.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2011-06-08 01:27:28 +0200
committerSebastian Thiel <byronimo@gmail.com>2011-06-08 01:27:28 +0200
commitfcc166d3a6e235933e823e82e1fcf6160a32a5d3 (patch)
tree8dc9adad3d5f405be47da68e0d0dd55b13897598 /git/refs/log.py
parentc3b7263e0bb9cc1d94e483e66c1494e0e7982fd1 (diff)
downloadgitpython-fcc166d3a6e235933e823e82e1fcf6160a32a5d3.tar.gz
log: non-existing logs no longer throw an exception, but are ignored. Fixed critical bug which caused packed-ref files to be written with native line endings, which made git fail to parse it. I wonder why I never noticed this before, or ignored it. Unbelievable \!
Diffstat (limited to 'git/refs/log.py')
-rw-r--r--git/refs/log.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/git/refs/log.py b/git/refs/log.py
index f49c07fd..e94c21f0 100644
--- a/git/refs/log.py
+++ b/git/refs/log.py
@@ -129,7 +129,13 @@ class RefLog(list, Serializable):
# END handle filepath
def _read_from_file(self):
- fmap = file_contents_ro_filepath(self._path, stream=False, allow_mmap=True)
+ try:
+ fmap = file_contents_ro_filepath(self._path, stream=False, allow_mmap=True)
+ except OSError:
+ # it is possible and allowed that the file doesn't exist !
+ return
+ #END handle invalid log
+
try:
self._deserialize(fmap)
finally: