mirror of
https://github.com/Dev-Wiki/git-repo.git
synced 2025-02-23 23:27:27 +08:00
Ignore EOFError when reading a truncated pickle file
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>
This commit is contained in:
parent
7b4f43542a
commit
2a3a81b51f
@ -236,6 +236,9 @@ class GitConfig(object):
|
||||
return cPickle.load(fd)
|
||||
finally:
|
||||
fd.close()
|
||||
except EOFError:
|
||||
os.remove(self._pickle)
|
||||
return None
|
||||
except IOError:
|
||||
os.remove(self._pickle)
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user