Commit c01b7841 by yuangli

improve error handling

parent cfc2ae68
......@@ -6,4 +6,3 @@
CMakeSettings.json
.vs
.idea
.cache
......@@ -11,7 +11,6 @@
#include "types.h"
#include "oid.h"
#include "buffer.h"
#include "oidarray.h"
/**
* @file git2/repository.h
......
......@@ -93,13 +93,17 @@ int git_grafts_refresh(git_grafts *grafts)
if (!grafts->path)
return 0;
error = git_futils_readbuffer_updated(&contents, grafts->path,
(grafts->path_checksum).id, &updated);
if (error < 0 || error == GIT_ENOTFOUND || !updated) {
if ((error = git_futils_readbuffer_updated(&contents, grafts->path,
(grafts->path_checksum).id, &updated)) < 0) {
if (error == GIT_ENOTFOUND) {
git_grafts_clear(grafts);
error = 0;
}
goto cleanup;
}
if (!updated) {
goto cleanup;
}
......
......@@ -735,13 +735,6 @@ 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;
......
......@@ -25,7 +25,6 @@
#include "submodule.h"
#include "diff_driver.h"
#include "grafts.h"
#include "oidarray.h"
#define DOT_GIT ".git"
#define GIT_DIR DOT_GIT "/"
......
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