From 90e780a3e16d0c3e4d7288728f6ba36e9c18d736 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 8 Jun 2011 01:27:28 +0200 Subject: 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 \! --- git/refs/log.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'git/refs/log.py') diff --git a/git/refs/log.py b/git/refs/log.py index 3b9d8514..562c6caa 100644 --- a/git/refs/log.py +++ b/git/refs/log.py @@ -126,7 +126,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: -- cgit v1.2.3