Improve error handling when reading loose refs
When repo is trying to figure out branches the repository has by
traversing refs/heads, add exception handling for readline.
Change-Id: If3b2a3720c6496f52f629aa9a2539f186d6ec882
diff --git a/git_refs.py b/git_refs.py
index ac8ed0c..0e3cc82 100644
--- a/git_refs.py
+++ b/git_refs.py
@@ -139,13 +139,15 @@
def _ReadLoose1(self, path, name):
try:
fd = open(path, 'rb')
- mtime = os.path.getmtime(path)
- except OSError:
+ except:
return
- except IOError:
- return
+
try:
- id = fd.readline()
+ try:
+ mtime = os.path.getmtime(path)
+ id = fd.readline()
+ except:
+ return
finally:
fd.close()