Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError in _ensure_no_pending #1221

Closed
progval opened this issue Oct 3, 2023 · 2 comments · Fixed by #1222
Closed

KeyError in _ensure_no_pending #1221

progval opened this issue Oct 3, 2023 · 2 comments · Fixed by #1222

Comments

@progval
Copy link
Contributor

progval commented Oct 3, 2023

While on the latest master (e71ece5):

$ python3 examples/clone.py https://github.com/ZSYniming/danwangshimoluo-JdScripts
Enumerating objects: 6885, done.
Counting objects: 100% (998/998), done.
Compressing objects: 100% (310/310), done.
Total 6885 (delta 635), reused 997 (delta 634), pack-reused 5887
copied 6884 pack entries84/6885
Traceback (most recent call last):
  File "/home/dev/dulwich/examples/clone.py", line 32, in <module>
    porcelain.clone(args[1], target_path)
  File "/home/dev/dulwich/dulwich/porcelain.py", line 542, in clone
    return client.clone(
           ^^^^^^^^^^^^^
  File "/home/dev/dulwich/dulwich/client.py", line 738, in clone
    result = self.fetch(path, target, progress=progress, depth=depth)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dev/dulwich/dulwich/client.py", line 828, in fetch
    commit()
  File "/home/dev/dulwich/dulwich/client.py", line 807, in commit
    target.object_store.add_thin_pack(f.read, None, progress=progress)
  File "/home/dev/dulwich/dulwich/object_store.py", line 932, in add_thin_pack
    return self._complete_pack(f, path, len(copier), indexer, progress=progress)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dev/dulwich/dulwich/object_store.py", line 863, in _complete_pack
    for i, entry in enumerate(indexer):
  File "/home/dev/dulwich/dulwich/pack.py", line 1441, in _walk_all_chains
    yield from self._walk_ref_chains()
  File "/home/dev/dulwich/dulwich/pack.py", line 1468, in _walk_ref_chains
    self._ensure_no_pending()
  File "/home/dev/dulwich/dulwich/pack.py", line 1446, in _ensure_no_pending
    raise KeyError([sha_to_hex(s) for s in self._pending_ref])
KeyError: [b'f320f4e315e866165c67c1802083574089050b19', b'2f451452900231f4b99e22695e824bbaa226779d']
@jelmer
Copy link
Owner

jelmer commented Oct 3, 2023

This is expected, the repository has unresolved deltas.

C git fails as well:

% git clone https://github.com/ZSYniming/danwangshimoluo-JdScripts
Cloning into 'danwangshimoluo-JdScripts'...
remote: Enumerating objects: 6885, done.
remote: Counting objects: 100% (998/998), done.
remote: Compressing objects: 100% (310/310), done.
remote: Total 6885 (delta 635), reused 997 (delta 634), pack-reused 5887
Receiving objects: 100% (6885/6885), 8.69 MiB | 2.75 MiB/s, done.
Resolving deltas:  95% (4293/4498), completed with 0 local objects.
fatal: pack has 205 unresolved deltas
fatal: fetch-pack: invalid index-pack output

we could probably raise a different exception if you wanted to catch this specifically and distinguish it from other errors?

@progval
Copy link
Contributor Author

progval commented Oct 3, 2023

Ah sorry, I didn't think of checking it worked with git clone.

we could probably raise a different exception if you wanted to catch this specifically and distinguish it from other errors?

That would be nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants