Commit ad563552 by Yuang Li

use shallow feature flag in shallow clone support source code

parent 6bab22f4
......@@ -500,14 +500,18 @@ int git_commit__parse_raw(void *commit, const char *data, size_t size)
int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned int flags)
{
git_repository *repo = git_object_owner((git_object *)commit);
git_commit_graft *graft;
int error;
if ((error = commit_parse(commit, git_odb_object_data(odb_obj),
git_odb_object_size(odb_obj), flags)) < 0)
return error;
if (GIT_OPT_ENABLE_SHALLOW) {
git_repository *repo = git_object_owner((git_object *)commit);
git_commit_graft *graft;
/* Perform necessary grafts */
if (git_grafts_get(&graft, repo->grafts, git_odb_object_id(odb_obj)) == 0 ||
git_grafts_get(&graft, repo->shallow_grafts, git_odb_object_id(odb_obj)) == 0) {
......@@ -523,6 +527,8 @@ int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned
}
}
}
return 0;
}
......
......@@ -926,7 +926,7 @@ int git_repository_open_ext(
if ((error = check_extensions(config, version)) < 0)
goto cleanup;
if ((error = load_grafts(repo)) < 0)
if (GIT_OPT_ENABLE_SHALLOW && (error = load_grafts(repo)) < 0)
goto cleanup;
if ((flags & GIT_REPOSITORY_OPEN_BARE) != 0)
......
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