summaryrefslogtreecommitdiff
path: root/gitdb/db
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2016-07-30 16:43:48 +0200
committerGitHub <noreply@github.com>2016-07-30 16:43:48 +0200
commit58cfb7e21253287240f24290e69c00e5e119c400 (patch)
treeaee6ea858fd1e828908b96735239ea24693efa8a /gitdb/db
parent40ec1fa3a2cfad1ace13f801a35364e9ec050d7f (diff)
parentf957c812ac3221773058ba2fa8cd38017537da8a (diff)
downloadgitdb-58cfb7e21253287240f24290e69c00e5e119c400.tar.gz
Merge pull request #28 from scop/with
Handle more file open/close with "with"
Diffstat (limited to 'gitdb/db')
-rw-r--r--gitdb/db/ref.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/gitdb/db/ref.py b/gitdb/db/ref.py
index 83a9f61..2e3db86 100644
--- a/gitdb/db/ref.py
+++ b/gitdb/db/ref.py
@@ -41,7 +41,8 @@ class ReferenceDB(CompoundDB):
# try to get as many as possible, don't fail if some are unavailable
ref_paths = list()
try:
- ref_paths = [l.strip() for l in open(self._ref_file, 'r').readlines()]
+ with open(self._ref_file, 'r') as f:
+ ref_paths = [l.strip() for l in f]
except (OSError, IOError):
pass
# END handle alternates