Unverified Commit 7ebd8a1d by Edward Thomson Committed by GitHub

Merge pull request #6684 from kcsaul/ignore_missing_grafts

Bypass shallow clone support for in-memory repositories
parents bd85506a 6855502c
...@@ -865,8 +865,30 @@ static int load_grafts(git_repository *repo) ...@@ -865,8 +865,30 @@ static int load_grafts(git_repository *repo)
git_str path = GIT_STR_INIT; git_str path = GIT_STR_INIT;
int error; int error;
if ((error = git_repository__item_path(&path, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 || /* refresh if they've both been opened previously */
(error = git_str_joinpath(&path, path.ptr, "grafts")) < 0 || if (repo->grafts && repo->shallow_grafts) {
if ((error = git_grafts_refresh(repo->grafts)) < 0 ||
(error = git_grafts_refresh(repo->shallow_grafts)) < 0)
return error;
}
/* resolve info path, which may not be found for inmemory repository */
if ((error = git_repository__item_path(&path, repo, GIT_REPOSITORY_ITEM_INFO)) < 0) {
if (error != GIT_ENOTFOUND)
return error;
/* create empty/inmemory grafts for inmemory repository */
if (!repo->grafts && (error = git_grafts_new(&repo->grafts, repo->oid_type)) < 0)
return error;
if (!repo->shallow_grafts && (error = git_grafts_new(&repo->shallow_grafts, repo->oid_type)) < 0)
return error;
return 0;
}
/* load grafts from disk */
if ((error = git_str_joinpath(&path, path.ptr, "grafts")) < 0 ||
(error = git_grafts_open_or_refresh(&repo->grafts, path.ptr, repo->oid_type)) < 0) (error = git_grafts_open_or_refresh(&repo->grafts, path.ptr, repo->oid_type)) < 0)
goto error; goto error;
......
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