From: Junio C Hamano Date: Tue, 08 Mar 2022 17:26:41 GMT Subject: Re: [PATCH v3 07/12] list-objects: handle NULL function pointers Message-ID: In-Reply-To: <782182a26e37eb8e84aef7d8cc67cf276b2abb54.1646750359.git.gitgitgadget@gmail.com> "Ævar Arnfjörð Bjarmason via GitGitGadget" writes: > Replace all callers of the show_commit and show_object function pointers > in list-objects.c to be local methods show_commit() and show_object() "to be local methods" -> "to call helper functions" > which check that the given contex has non-NULL functions before passing "contex" -> "context" > the necessary data. One extra benefit is that it reduces duplication > due to passing ctx->show_data to every caller. > - ctx->show_object(obj, path->buf, ctx->show_data); > + show_object(ctx, obj, path->buf); I guess this is the "reduced duplication" refers to. The helper does make it easier to follow and reason about: "show the given object at the path in this context" is what it asks. > diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh > index b13e8a52a93..6522401617d 100755 > --- a/t/t6020-bundle-misc.sh > +++ b/t/t6020-bundle-misc.sh > @@ -475,4 +475,16 @@ test_expect_success 'clone from bundle' ' > test_cmp expect actual > ' > > +test_expect_success 'unfiltered bundle with --objects' ' > + git bundle create all-objects.bdl \ > + --all --objects && > + git bundle create all.bdl \ > + --all && > + > + # Compare the headers of these files. > + head -11 all.bdl >expect && > + head -11 all-objects.bdl >actual && "head -n 11" but more importantly, why eleven and not ten or twelve? Is that a number this code can automatically learn from the given .bdl file?