Subject: Re: [PATCH v4 08/16] revision.c: use refs_for_each*() instead of for_each_*_submodule()

From: Junio C Hamano <[email-masked]>
Date: Thu, 24 Aug 2017 14:56:02 -0700

Nguyễn Thái Ngọc Duy  <[email-masked]> writes:

> Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
> ---

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.

> @@ -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();
> +