Commit a8b1d515 by Etienne Samson Committed by Patrick Steinhardt

repo: graft shallow roots on open

parent 3c17f229
......@@ -654,6 +654,27 @@ cleanup:
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)
......@@ -946,6 +967,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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment