libgit2 / libgit2/rugged

Add support for walking through shallow clones

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

Nobody has claimed this yet.

libgit2
Dominant language
C
Stars
2.3k
Forks
293
PR merge metrics
No merged PRs in 30d

Description

Rugged doesn't support walking through the commits of partially cloned repositories:

In the shell do:

cd /tmp/
git clone --depth 1 git@github.com:eugenk/importing_owl.git

And then in the ruby console do:

r = Rugged::Repository.new('/tmp/importing_owl')
walker = Rugged::Walker.new(r)
walker.push(r.head.target.oid)
walker.each { |c| puts c.inspect }

which results in

Rugged::OdbError: Object not found - failed to find pack entry (c84d1be7573e2367e175b8675fcc347aaf13a27b)

where c84d1b is the parent commit oid.

Rescuing from Rugged::OdbError won't help because the walker raises this error as soon as the iterator starts walking - not when trying to find the missing parent commit.

This happens regardless of the sorting method (walker.sorting(Rugged::SORT_REVERSE) or walker.sorting(Rugged::SORT_TOPO))

If the oldest existing commit is a merge commit, then the error is not being raised. However, absolutely nothing happens, i.e. no commits are being iterated over.

The expected behaviour is at least to run through the commits which actually exist and then raise an error.

Contributor guide

No contributing guide indexed for this repository

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 shallow-clone case using Rugged::Repository and Rugged::Walker as shown, including both sorting modes and the merge-commit case. Start by tracing when walker iteration begins and how missing parent commits are handled. Done means locally available commits are yielded before the missing-parent error is reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, git, ruby
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.