Skip to content

Commit 346424d

Browse files
committed
Assure to not iterate packed-refs file, ever.
Related to #252
1 parent 0f5320e commit 346424d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: git/refs/symbolic.py

+3
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def _get_ref_info(cls, repo, ref_path):
140140
# Don't only split on spaces, but on whitespace, which allows to parse lines like
141141
# 60b64ef992065e2600bfef6187a97f92398a9144 branch 'master' of git-server:/path/to/repo
142142
tokens = value.split()
143+
assert(len(tokens) != 0)
143144
except (OSError, IOError):
144145
# Probably we are just packed, find our entry in the packed refs file
145146
# NOTE: We are not a symbolic ref if we are in a packed file, as these
@@ -582,6 +583,8 @@ def _iter_items(cls, repo, common_path=None):
582583
# END prune non-refs folders
583584

584585
for f in files:
586+
if f == 'packed-refs':
587+
continue
585588
abs_path = to_native_path_linux(join_path(root, f))
586589
rela_paths.add(abs_path.replace(to_native_path_linux(repo.git_dir) + '/', ""))
587590
# END for each file in root directory

0 commit comments

Comments
 (0)