summaryrefslogtreecommitdiff
path: root/git/remote.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/remote.py')
-rw-r--r--git/remote.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/git/remote.py b/git/remote.py
index 58238991..c2ffcc1a 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -638,9 +638,8 @@ class Remote(LazyMixin, Iterable):
finalize_process(proc, stderr=stderr_text)
# read head information
- fp = open(join(self.repo.git_dir, 'FETCH_HEAD'), 'rb')
- fetch_head_info = [l.decode(defenc) for l in fp.readlines()]
- fp.close()
+ with open(join(self.repo.git_dir, 'FETCH_HEAD'), 'rb') as fp:
+ fetch_head_info = [l.decode(defenc) for l in fp.readlines()]
l_fil = len(fetch_info_lines)
l_fhi = len(fetch_head_info)