diff options
author | Russell Belfer <rb@github.com> | 2012-08-06 11:06:05 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-08-06 11:06:05 -0700 |
commit | e4607392b5cbdcaf6a5dc810ca77b5dd1afcb147 (patch) | |
tree | cec6b085e1829b45943dcbd54127e389e55e04d8 | |
parent | 81f73a872c914fd9fe163a88a7fed48cb0b1027d (diff) | |
download | libgit2-e4607392b5cbdcaf6a5dc810ca77b5dd1afcb147.tar.gz |
Fix iterator check and return value
There is a little cleanup necessary from PR #843. Since the
new callbacks return `GIT_EUSER` we have to be a little careful
about return values when they are used internally to the library.
Also, callbacks should be checked for non-zero return values,
not just less than zero.
-rw-r--r-- | src/remote.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/remote.c b/src/remote.c index a90c8a70f..fc1a2ecc1 100644 --- a/src/remote.c +++ b/src/remote.c @@ -420,7 +420,7 @@ int git_remote_ls(git_remote *remote, git_headlist_cb list_cb, void *payload) pkt = (git_pkt_ref *)p; - if (list_cb(&pkt->head, payload) < 0) + if (list_cb(&pkt->head, payload)) return GIT_EUSER; } @@ -596,6 +596,11 @@ int git_remote_list(git_strarray *remotes_list, git_repository *repo) } git_vector_free(&list); + + /* cb error is converted to GIT_EUSER by git_config_foreach */ + if (error == GIT_EUSER) + error = -1; + return error; } |