diff options
Diffstat (limited to 'git_refs.py')
-rw-r--r-- | git_refs.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/git_refs.py b/git_refs.py index 98ed1e2f..debd4cbf 100644 --- a/git_refs.py +++ b/git_refs.py | |||
@@ -141,18 +141,11 @@ class GitRefs(object): | |||
141 | 141 | ||
142 | def _ReadLoose1(self, path, name): | 142 | def _ReadLoose1(self, path, name): |
143 | try: | 143 | try: |
144 | fd = open(path) | 144 | with open(path) as fd: |
145 | except IOError: | ||
146 | return | ||
147 | |||
148 | try: | ||
149 | try: | ||
150 | mtime = os.path.getmtime(path) | 145 | mtime = os.path.getmtime(path) |
151 | ref_id = fd.readline() | 146 | ref_id = fd.readline() |
152 | except (IOError, OSError): | 147 | except (IOError, OSError): |
153 | return | 148 | return |
154 | finally: | ||
155 | fd.close() | ||
156 | 149 | ||
157 | try: | 150 | try: |
158 | ref_id = ref_id.decode() | 151 | ref_id = ref_id.decode() |