mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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:
parent
3ce2a6b46b
commit
cc14fa9820
12
git_refs.py
12
git_refs.py
@ -139,13 +139,15 @@ class GitRefs(object):
|
|||||||
def _ReadLoose1(self, path, name):
|
def _ReadLoose1(self, path, name):
|
||||||
try:
|
try:
|
||||||
fd = open(path, 'rb')
|
fd = open(path, 'rb')
|
||||||
mtime = os.path.getmtime(path)
|
except:
|
||||||
except OSError:
|
|
||||||
return
|
|
||||||
except IOError:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
id = fd.readline()
|
try:
|
||||||
|
mtime = os.path.getmtime(path)
|
||||||
|
id = fd.readline()
|
||||||
|
except:
|
||||||
|
return
|
||||||
finally:
|
finally:
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user