libgit2 / libgit2/pygit2

Can not walk over a repository with detached HEAD

Open
#993 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
408
Avg merge
2d 57m
Merged PRs (30d)
7

Description

Subject says it all. Here is the steps to reproduce it:

% git clone --depth 1 <URL> 
% git fetch --depth 1 origin <revision hash>
% git checkout FETCH_HEAD

>>> from pygit2 import Repository
>>> repo = Repositoy(<Path to a repo>)
>>> for commit in repo.walk(revision):
...     pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'object not found - no match for id (0c946642a3608917c3c543355de6426d5b69583b)'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the detached-HEAD setup with the listed clone, fetch, and checkout commands, then run the pygit2 Repository.walk example. Start at the repo.walk entry point and trace the object lookup behind the KeyError. Done means walking the revision completes without the reported object-not-found error.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.