summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-06-12 09:10:07 -0700
committerShawn O. Pearce <sop@google.com>2009-06-12 09:10:07 -0700
commit2a3a81b51f1aee5a2da789d07d14cde61c96e8b7 (patch)
tree83c0e16790ce993efb6be4a8300a2943cecb83ba
parent7b4f43542a5dec931f73076d891f8509a69f98e8 (diff)
downloadgit-repo-1.6.8.2.tar.gz
Ignore EOFError when reading a truncated pickle filev1.6.8.2
If the pickle config file is 0 bytes in length, we may have crashed (or been aborted) while writing the file out to disk. Instead of crashing with a backtrace, just treat the file as though it wasn't present and load off a `git config` fork. Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--git_config.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/git_config.py b/git_config.py
index a2a739a4..d33c3b12 100644
--- a/git_config.py
+++ b/git_config.py
@@ -236,6 +236,9 @@ class GitConfig(object):
236 return cPickle.load(fd) 236 return cPickle.load(fd)
237 finally: 237 finally:
238 fd.close() 238 fd.close()
239 except EOFError:
240 os.remove(self._pickle)
241 return None
239 except IOError: 242 except IOError:
240 os.remove(self._pickle) 243 os.remove(self._pickle)
241 return None 244 return None