Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit58c5b99

Browse files
committed
Ensure file resources are released
1 parent11b3a1d commit58c5b99

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

‎git/refs/symbolic.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,25 @@ def _iter_packed_refs(cls, repo):
8888
"""Returns an iterator yielding pairs of sha1/path pairs (as bytes) for the corresponding refs.
8989
:note: The packed refs file will be kept open as long as we iterate"""
9090
try:
91-
fp=open(cls._get_packed_refs_path(repo),'rt')
92-
forlineinfp:
93-
line=line.strip()
94-
ifnotline:
95-
continue
96-
ifline.startswith('#'):
97-
ifline.startswith('# pack-refs with:')andnotline.endswith('peeled'):
98-
raiseTypeError("PackingType of packed-Refs not understood: %r"%line)
99-
# END abort if we do not understand the packing scheme
100-
continue
101-
# END parse comment
91+
withopen(cls._get_packed_refs_path(repo),'rt')asfp:
92+
forlineinfp:
93+
line=line.strip()
94+
ifnotline:
95+
continue
96+
ifline.startswith('#'):
97+
ifline.startswith('# pack-refs with:')andnotline.endswith('peeled'):
98+
raiseTypeError("PackingType of packed-Refs not understood: %r"%line)
99+
# END abort if we do not understand the packing scheme
100+
continue
101+
# END parse comment
102102

103-
# skip dereferenced tag object entries - previous line was actual
104-
# tag reference for it
105-
ifline[0]=='^':
106-
continue
103+
# skip dereferenced tag object entries - previous line was actual
104+
# tag reference for it
105+
ifline[0]=='^':
106+
continue
107107

108-
yieldtuple(line.split(' ',1))
109-
# END for each line
108+
yieldtuple(line.split(' ',1))
109+
# END for each line
110110
except (OSError,IOError):
111111
raiseStopIteration
112112
# END no packed-refs file handling

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp