summaryrefslogtreecommitdiff
path: root/src/notes.c
diff options
context:
space:
mode:
authorVicent Marti <vicent@github.com>2013-12-13 06:20:19 -0800
committerVicent Marti <vicent@github.com>2013-12-13 06:20:19 -0800
commit79194bcdc956406979cd27ac99198826860d3f20 (patch)
tree407594b97b6e39ef3ac0723dc33aa3162ce933cc /src/notes.c
parent25a1fab0a96fd87e4ebc4ec195ac59a4213e92ad (diff)
parent7a16d54b5457aa9f60c25a204277ae0ce609ad2e (diff)
downloadlibgit2-79194bcdc956406979cd27ac99198826860d3f20.tar.gz
Merge pull request #1986 from libgit2/rb/error-handling-cleanups
Clean up some error handling and change callback error behavior
Diffstat (limited to 'src/notes.c')
-rw-r--r--src/notes.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/notes.c b/src/notes.c
index beace1b50..795904917 100644
--- a/src/notes.c
+++ b/src/notes.c
@@ -378,20 +378,11 @@ cleanup:
static int note_get_default_ref(const char **out, git_repository *repo)
{
- int ret;
git_config *cfg;
+ int ret = git_repository_config__weakptr(&cfg, repo);
- *out = NULL;
-
- if (git_repository_config__weakptr(&cfg, repo) < 0)
- return -1;
-
- ret = git_config_get_string(out, cfg, "core.notesRef");
- if (ret == GIT_ENOTFOUND) {
- giterr_clear();
- *out = GIT_NOTES_DEFAULT_REF;
- return 0;
- }
+ *out = (ret != 0) ? NULL : git_config__get_string_force(
+ cfg, "core.notesref", GIT_NOTES_DEFAULT_REF);
return ret;
}
@@ -592,8 +583,8 @@ int git_note_foreach(
return error;
while (!(error = git_note_next(&note_id, &annotated_id, iter))) {
- if (note_cb(&note_id, &annotated_id, payload)) {
- error = GIT_EUSER;
+ if ((error = note_cb(&note_id, &annotated_id, payload)) != 0) {
+ giterr_set_after_callback(error);
break;
}
}