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
This commit is contained in:
Shawn O. Pearce 2011-11-29 12:32:56 -08:00
parent 3ce2a6b46b
commit cc14fa9820

View File

@ -139,13 +139,15 @@ class GitRefs(object):
def _ReadLoose1(self, path, name):
try:
fd = open(path, 'rb')
mtime = os.path.getmtime(path)
except OSError:
return
except IOError:
except:
return
try:
try:
mtime = os.path.getmtime(path)
id = fd.readline()
except:
return
finally:
fd.close()