Message ID | pull.1006.v2.git.git.1621438289354.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 617480d75bdca266d4549e4047452c633ddb7a52 |
Headers | show |
Series | [v2] refs: make explicit that ref_iterator_peel returns boolean | expand |
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes: > From: Han-Wen Nienhuys <hanwen@google.com> > > Use -1 as error return value throughout. So this corresponds to the bottommost step in the series that is queued as hn/reftable, with the difference at the end of this message. Do you want me to replace that single step with this version and rebuild the remainder of the topic on top? Thanks. diff --git c/refs.c w/refs.c index 7292c80a26..3b3478a2f1 100644 --- c/refs.c +++ w/refs.c @@ -2020,7 +2020,7 @@ int peel_iterated_oid(const struct object_id *base, struct object_id *peeled) oideq(current_ref_iter->oid, base))) return ref_iterator_peel(current_ref_iter, peeled); - return !!peel_object(base, peeled); + return peel_object(base, peeled) ? -1 : 0; } int refs_create_symref(struct ref_store *refs, diff --git c/refs/packed-backend.c w/refs/packed-backend.c index dfecdbc1db..66cb90c79e 100644 --- c/refs/packed-backend.c +++ w/refs/packed-backend.c @@ -889,7 +889,7 @@ static int packed_ref_iterator_peel(struct ref_iterator *ref_iterator, } else if ((iter->base.flags & (REF_ISBROKEN | REF_ISSYMREF))) { return -1; } else { - return !!peel_object(&iter->oid, peeled); + return peel_object(&iter->oid, peeled) ? -1 : 0; } } diff --git c/refs/ref-cache.c w/refs/ref-cache.c index 703a12959e..49d732f6db 100644 --- c/refs/ref-cache.c +++ w/refs/ref-cache.c @@ -491,7 +491,7 @@ static int cache_ref_iterator_advance(struct ref_iterator *ref_iterator) static int cache_ref_iterator_peel(struct ref_iterator *ref_iterator, struct object_id *peeled) { - return !!peel_object(ref_iterator->oid, peeled); + return peel_object(ref_iterator->oid, peeled) ? -1 : 0; } static int cache_ref_iterator_abort(struct ref_iterator *ref_iterator) diff --git c/refs/refs-internal.h w/refs/refs-internal.h index 7b427b58f6..2bdabf7b4a 100644 --- c/refs/refs-internal.h +++ w/refs/refs-internal.h @@ -454,7 +454,7 @@ void base_ref_iterator_free(struct ref_iterator *iter); typedef int ref_iterator_advance_fn(struct ref_iterator *ref_iterator); /* - * Peels the current ref, returning 0 for success. + * Peels the current ref, returning 0 for success or -1 for failure. */ typedef int ref_iterator_peel_fn(struct ref_iterator *ref_iterator, struct object_id *peeled);
On Thu, May 20, 2021 at 12:58 AM Junio C Hamano <gitster@pobox.com> wrote: > > Use -1 as error return value throughout. > > So this corresponds to the bottommost step in the series that is > queued as hn/reftable, with the difference at the end of this > message. > > Do you want me to replace that single step with this version and > rebuild the remainder of the topic on top? Yes. I'm hoping this can graduate soon, so the hn/reftable topic becomes smaller (I don't know what that means for your organization of the seen branch).
On Thu, May 20, 2021 at 11:04 AM Han-Wen Nienhuys <hanwen@google.com> wrote: > > So this corresponds to the bottommost step in the series that is > > queued as hn/reftable, with the difference at the end of this > > message. > > > > Do you want me to replace that single step with this version and > > rebuild the remainder of the topic on top? > > Yes. > > I'm hoping this can graduate soon, so the hn/reftable topic becomes > smaller (I don't know what that means for your organization of the > seen branch). Any update on this? This wasn't queued for next, but I believe it should be.
Han-Wen Nienhuys <hanwen@google.com> writes: > On Thu, May 20, 2021 at 11:04 AM Han-Wen Nienhuys <hanwen@google.com> wrote: >> > So this corresponds to the bottommost step in the series that is >> > queued as hn/reftable, with the difference at the end of this >> > message. >> > >> > Do you want me to replace that single step with this version and >> > rebuild the remainder of the topic on top? >> >> Yes. >> >> I'm hoping this can graduate soon, so the hn/reftable topic becomes >> smaller (I don't know what that means for your organization of the >> seen branch). > > Any update on this? This wasn't queued for next, but I believe it should be. Sorry, I thought you meant you wanted to fix up the bottommost commit in that series, which I think was already done at 617480d7 (refs: make explicit that ref_iterator_peel returns boolean, 2021-05-19), and did not realize that you wanted a separate single patch topic for this step, on top of which the remainder of the other topic builds. Will do. Thanks.
diff --git a/refs.c b/refs.c index 8c9490235ea6..8b9f7c3a80a0 100644 --- a/refs.c +++ b/refs.c @@ -2010,7 +2010,7 @@ int peel_iterated_oid(const struct object_id *base, struct object_id *peeled) oideq(current_ref_iter->oid, base))) return ref_iterator_peel(current_ref_iter, peeled); - return peel_object(base, peeled); + return peel_object(base, peeled) ? -1 : 0; } int refs_create_symref(struct ref_store *refs, diff --git a/refs/packed-backend.c b/refs/packed-backend.c index dfecdbc1db60..66cb90c79ee0 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -889,7 +889,7 @@ static int packed_ref_iterator_peel(struct ref_iterator *ref_iterator, } else if ((iter->base.flags & (REF_ISBROKEN | REF_ISSYMREF))) { return -1; } else { - return !!peel_object(&iter->oid, peeled); + return peel_object(&iter->oid, peeled) ? -1 : 0; } } diff --git a/refs/ref-cache.c b/refs/ref-cache.c index 46f1e5428433..49d732f6db96 100644 --- a/refs/ref-cache.c +++ b/refs/ref-cache.c @@ -491,7 +491,7 @@ static int cache_ref_iterator_advance(struct ref_iterator *ref_iterator) static int cache_ref_iterator_peel(struct ref_iterator *ref_iterator, struct object_id *peeled) { - return peel_object(ref_iterator->oid, peeled); + return peel_object(ref_iterator->oid, peeled) ? -1 : 0; } static int cache_ref_iterator_abort(struct ref_iterator *ref_iterator) diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 467f4b3c936d..3155708345fc 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -453,6 +453,9 @@ void base_ref_iterator_free(struct ref_iterator *iter); */ typedef int ref_iterator_advance_fn(struct ref_iterator *ref_iterator); +/* + * Peels the current ref, returning 0 for success or -1 for failure. + */ typedef int ref_iterator_peel_fn(struct ref_iterator *ref_iterator, struct object_id *peeled);