Re: [PATCH v4 08/16] revision.c: use refs_for_each*() instead of for_each_*_submodule()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 24, 2017, 21:56 UTC
- Message-ID
- <xmqqbmn4vde5.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170823123704.16518-9-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> > ---
So... the idea is that the caller gives a ref-store and tells these functions to iterate over refs in it, and the existing submodule related callers can prepare a ref-store for the submodule---that way, refs.[ch] layer does not have to _care_ that the set of refs it was asked to look at is for submodule processing.
Nice. Very nice.
Show 12 quoted lines
> @@ -2120,8 +2129,14 @@ static int handle_revision_pseudo_opt(const char *submodule,
> {
> const char *arg = argv[0];
> const char *optarg;
> + struct ref_store *refs;
> int argcount;
>
> + if (submodule) {
> + refs = get_submodule_ref_store(submodule);
> + } else
> + refs = get_main_ref_store();
> +