Skip to content

Shallow support#4331

Open
tiennou wants to merge 10 commits into
libgit2:mainfrom
tiennou:shallow/shallow-support
Open

Shallow support#4331
tiennou wants to merge 10 commits into
libgit2:mainfrom
tiennou:shallow/shallow-support

Conversation

@tiennou

@tiennou tiennou commented Aug 22, 2017

Copy link
Copy Markdown
Contributor

This PR enhance our shallow object support in the following ways :

  • we behave better when revwalking (we don't error with GIT_ENOTFOUND).
  • we don't return objects with known-missing parents (since our repository is shallow and thus doesn't have those objects).

Supersedes #3853, depends on #4445 and #4446.

This PR adds graft support at the ODB layer, with git_repository being responsible for telling git_odb about known grafts. Shallow object support is then grafted (heh) on top of that.

Notes :
- I'm not that convinced that having grafts at the ODB layer makes sense. FWIW, the crux of the issue is that object parsing is not done when objects are returned by the ODB, but by the caller (usually the object parse machinery, but revwalk also perform crude parsing for obvious reasons).

  • @carlosmn pointed out the preferred approach (ie. that's what git does) is to have grafts be "transparent". IMHO, reporting an error in that case might help in the following cases :
    • every object parsed is checked against the list of known grafts (so perf). The error code would just be a subset of GIT_ENOTFOUND.
    • as a library user, I would have to recheck every object to know if I'm looking at a graft (with the caveat that this PR doesn't actually exposes grafts, only shallow commits). Having the error code makes me automatically aware (and I can just treat it as GIT_EITEROVER if I don't actually care).

Loading
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 this pull request may close these issues.

7 participants