From: mhagger@alum.mit.edu Date: Fri, 28 Oct 2011 11:27:58 GMT Subject: [PATCH v2 06/12] do_for_each_ref(): correctly terminate while processesing extra_refs Message-ID: <1319801284-15625-7-git-send-email-mhagger@alum.mit.edu> In-Reply-To: <1319801284-15625-1-git-send-email-mhagger@alum.mit.edu> From: Michael Haggerty If the user-supplied function returns a nonzero value while processing extra_refs, terminate without processing the rest of the list. This probably has no practical importance, but makes the handling of extra_refs a little bit more consistent with the handling of other refs. Signed-off-by: Michael Haggerty --- refs.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/refs.c b/refs.c index c76d8b5..8043436 100644 --- a/refs.c +++ b/refs.c @@ -710,8 +710,11 @@ static int do_for_each_ref(const char *submodule, const char *base, each_ref_fn struct ref_array *extra = &extra_refs; - for (i = 0; i < extra->nr; i++) + for (i = 0; i < extra->nr; i++) { retval = do_one_ref(base, fn, trim, flags, cb_data, extra->refs[i]); + if (retval) + goto end_each; + } while (p < packed->nr && l < loose->nr) { struct ref_entry *entry; -- 1.7.7