diff options
| author | Vicent Marti <tanoku@gmail.com> | 2012-08-06 12:41:08 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2012-08-06 12:41:08 +0200 |
| commit | 51e1d8084641bd36416bf6f127b31d47d64cce69 (patch) | |
| tree | 1a95e6b4c664020eb4bbff843eead794f3ee3d35 /src/refs.c | |
| parent | 7e9f78b5fee2d8f56711a587c35fcba10d370547 (diff) | |
| parent | b0d376695e7d3f71fed97d9d08b60661faad7a5a (diff) | |
| download | libgit2-51e1d8084641bd36416bf6f127b31d47d64cce69.tar.gz | |
Merge remote-tracking branch 'arrbee/tree-walk-fixes' into development
Conflicts:
src/notes.c
src/transports/git.c
src/transports/http.c
src/transports/local.c
tests-clar/odb/foreach.c
Diffstat (limited to 'src/refs.c')
| -rw-r--r-- | src/refs.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/refs.c b/src/refs.c index 32f54fc31..0e0a491ec 100644 --- a/src/refs.c +++ b/src/refs.c @@ -500,6 +500,7 @@ struct dirent_list_data { int (*callback)(const char *, void *); void *callback_payload; + int callback_error; }; static int _dirent_loose_listall(void *_data, git_buf *full_path) @@ -520,7 +521,10 @@ static int _dirent_loose_listall(void *_data, git_buf *full_path) return 0; /* we are filtering out this reference */ } - return data->callback(file_path, data->callback_payload); + if (data->callback(file_path, data->callback_payload)) + data->callback_error = GIT_EUSER; + + return data->callback_error; } static int _dirent_loose_load(void *data, git_buf *full_path) @@ -843,15 +847,17 @@ static int reference_path_available( const char *ref, const char* old_ref) { + int error; struct reference_available_t data; data.new_ref = ref; data.old_ref = old_ref; data.available = 1; - if (git_reference_foreach(repo, GIT_REF_LISTALL, - _reference_available_cb, (void *)&data) < 0) - return -1; + error = git_reference_foreach( + repo, GIT_REF_LISTALL, _reference_available_cb, (void *)&data); + if (error < 0) + return error; if (!data.available) { giterr_set(GITERR_REFERENCE, @@ -1486,8 +1492,8 @@ int git_reference_foreach( return -1; git_strmap_foreach(repo->references.packfile, ref_name, ref, { - if (callback(ref_name, payload) < 0) - return 0; + if (callback(ref_name, payload)) + return GIT_EUSER; }); } @@ -1499,14 +1505,16 @@ int git_reference_foreach( data.repo = repo; data.callback = callback; data.callback_payload = payload; + data.callback_error = 0; if (git_buf_joinpath(&refs_path, repo->path_repository, GIT_REFS_DIR) < 0) return -1; result = git_path_direach(&refs_path, _dirent_loose_listall, &data); + git_buf_free(&refs_path); - return result; + return data.callback_error ? GIT_EUSER : result; } static int cb__reflist_add(const char *ref, void *data) |
