summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryuangli <yuangli@mathworks.com>2022-07-28 14:30:30 +0100
committeryuangli <yuangli@mathworks.com>2022-07-28 14:30:30 +0100
commit14d2a60a5bdb6fe62b65751bda0ce01a66ac5e99 (patch)
tree926c8e55679a83c1bb145821ba3e4268eb662056
parentc01b7841b77c08189eae916d21d591027962a831 (diff)
downloadlibgit2-14d2a60a5bdb6fe62b65751bda0ce01a66ac5e99.tar.gz
fix load_grafts
-rw-r--r--src/libgit2/repository.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libgit2/repository.c b/src/libgit2/repository.c
index c36666c43..809617276 100644
--- a/src/libgit2/repository.c
+++ b/src/libgit2/repository.c
@@ -735,6 +735,13 @@ static int load_grafts(git_repository *repo)
git_str path = GIT_STR_INIT;
int error;
+ if ((error = git_repository__item_path(&path, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 ||
+ (error = git_str_joinpath(&path, path.ptr, "grafts")) < 0 ||
+ (error = git_grafts_from_file(&repo->grafts, path.ptr)) < 0)
+ goto error;
+
+ git_str_clear(&path);
+
if ((error = git_str_joinpath(&path, repo->gitdir, "shallow")) < 0 ||
(error = git_grafts_from_file(&repo->shallow_grafts, path.ptr)) < 0)
goto error;