Re: [PATCH v3 02/19] convert: add [async_]convert_to_working_tree_ca() variants
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 29, 2020, 23:48 UTC
- Message-ID
- <xmqqy2jo386z.fsf@gitster.c.googlers.com>
- In-Reply-To
- <c5fbd1e16d616a4c238d98a35f3671238300c17f.1603937110.git.matheus.bernardino@usp.br>
Matheus Tavares <matheus.bernardino@usp.br> writes:
> -static int convert_to_working_tree_internal(const struct index_state *istate, > +static int convert_to_working_tree_internal(const struct conv_attrs *ca,
Makes sense. Once we know conv_attrs, we do not need the istate to convert the contents.
Show 19 quoted lines
> @@ -1497,7 +1494,9 @@ int async_convert_to_working_tree(const struct index_state *istate,
> const struct checkout_metadata *meta,
> void *dco)
> {
> - return convert_to_working_tree_internal(istate, path, src, len, dst, 0, meta, dco);
> + struct conv_attrs ca;
> + convert_attrs(istate, &ca, path);
> + return convert_to_working_tree_internal(&ca, path, src, len, dst, 0, meta, dco);
> }
>
> @@ -1505,13 +1504,36 @@ int convert_to_working_tree(const struct index_state *istate,
> size_t len, struct strbuf *dst,
> const struct checkout_metadata *meta)
> {
> - return convert_to_working_tree_internal(istate, path, src, len, dst, 0, meta, NULL);
> + struct conv_attrs ca;
> + convert_attrs(istate, &ca, path);
> + return convert_to_working_tree_internal(&ca, path, src, len, dst, 0, meta, NULL);
> +}OK, these naturally implement "let's lift convert_attrs() out of the callee and move it to the callers". However...
Show 16 quoted lines
> +int async_convert_to_working_tree_ca(const struct conv_attrs *ca,
> + const char *path, const char *src,
> + size_t len, struct strbuf *dst,
> + const struct checkout_metadata *meta,
> + void *dco)
> +{
> + return convert_to_working_tree_internal(ca, path, src, len, dst, 0, meta, dco);
> +}
> +
> +int convert_to_working_tree_ca(const struct conv_attrs *ca,
> + const char *path, const char *src,
> + size_t len, struct strbuf *dst,
> + const struct checkout_metadata *meta)
> +{
> + return convert_to_working_tree_internal(ca, path, src, len, dst, 0, meta, NULL);
> }... shouldn't they be implemented as thin wrappers around these new *_ca() variants of the API functions? Otherwise, the *_ca() variants are not yet used by anybody yet at this step, are they?