|
@@ -753,23 +753,23 @@ def read_packed_refs_with_peeled(f):
|
|
|
:param f: file-like object to read from, seek'ed to the second line
|
|
|
"""
|
|
|
last = None
|
|
|
- for l in f:
|
|
|
- if l[0] == b'#':
|
|
|
+ for line in f:
|
|
|
+ if line[0] == b'#':
|
|
|
continue
|
|
|
- l = l.rstrip(b'\r\n')
|
|
|
- if l.startswith(b'^'):
|
|
|
+ line = line.rstrip(b'\r\n')
|
|
|
+ if line.startswith(b'^'):
|
|
|
if not last:
|
|
|
raise PackedRefsException("unexpected peeled ref line")
|
|
|
- if not valid_hexsha(l[1:]):
|
|
|
- raise PackedRefsException("Invalid hex sha %r" % l[1:])
|
|
|
+ if not valid_hexsha(line[1:]):
|
|
|
+ raise PackedRefsException("Invalid hex sha %r" % line[1:])
|
|
|
sha, name = _split_ref_line(last)
|
|
|
last = None
|
|
|
- yield (sha, name, l[1:])
|
|
|
+ yield (sha, name, line[1:])
|
|
|
else:
|
|
|
if last:
|
|
|
sha, name = _split_ref_line(last)
|
|
|
yield (sha, name, None)
|
|
|
- last = l
|
|
|
+ last = line
|
|
|
if last:
|
|
|
sha, name = _split_ref_line(last)
|
|
|
yield (sha, name, None)
|