10000 [WIP] Shallow smart transport support by tiennou · Pull Request #4747 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

[WIP] Shallow smart transport support #4747

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

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
repo: graft shallow roots on open
  • Loading branch information
tiennou committed Feb 3, 2019
commit 94947d8863d64d672d80c2e32efe5dfa2b455da7
24 changes: 24 additions & 0 deletions src/repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,27 @@ static int load_grafts(git_repository *repo)
return error;
}

static int load_shallow(git_repository *repo)
{
int error = 0;
git_array_oid_t roots = GIT_ARRAY_INIT;
git_array_oid_t parents = GIT_ARRAY_INIT;
size_t i;
git_oid *graft_oid;

/* Graft shallow roots */
if ((error = git_repository__shallow_roots(&roots, repo)) < 0) {
return error;
}

git_array_foreach(roots, i, graft_oid) {
if ((error = git__graft_register(repo->grafts, graft_oid, parents)) < 0) {
return error;
}
}
return 0;
}

int git_repository_open_bare(
git_repository **repo_ptr,
const char *bare_path)
Expand Down Expand Up @@ -927,6 +948,9 @@ int git_repository_open_ext(
if ((error = load_grafts(repo)) < 0)
goto cleanup;

if ((error = load_shallow(repo)) < 0)
goto cleanup;

if ((flags & GIT_REPOSITORY_OPEN_BARE) != 0)
repo->is_bare = 1;
else {
Expand Down
0