summaryrefslogtreecommitdiff
path: root/src/libgit2/grafts.c
diff options
context:
space:
mode:
authoryuangli <yuangli@mathworks.com>2022-07-28 14:24:18 +0100
committeryuangli <yuangli@mathworks.com>2022-07-28 14:24:18 +0100
commitc01b7841b77c08189eae916d21d591027962a831 (patch)
tree939cac6050006cebc82d1e4b334b8c6c07f599e2 /src/libgit2/grafts.c
parentcfc2ae68b4792f0c64152888869ef69d868079d7 (diff)
downloadlibgit2-c01b7841b77c08189eae916d21d591027962a831.tar.gz
improve error handling
Diffstat (limited to 'src/libgit2/grafts.c')
-rw-r--r--src/libgit2/grafts.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libgit2/grafts.c b/src/libgit2/grafts.c
index 8bcefbab9..82be2a680 100644
--- a/src/libgit2/grafts.c
+++ b/src/libgit2/grafts.c
@@ -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;
}