Re: [PATCH v6 3/9] ref: initialize target name outside of check functions
shejialuo <shejialuo@gmail.com> writes:
Show 8 quoted lines
> We passes "refs_check_dir" to the "files_fsck_refs_name" function which
> allows it to create the checked ref name later. However, when we
> introduce a new check function, we have to re-calculate the target name.
> It's bad for us to do repeat calculation. Instead, we should calculate
> it only once and pass the target name to the check functions.
>
> In order not to do repeat calculation, rename "refs_check_dir" to
> "target_name". And in "files_fsck_refs_dir", create a new strbuf
Nit: Why `target_name` and not simply `target`?
Show 10 quoted lines
> "target_name", thus whenever we handle a new target, calculate the
> name and call the check functions one by one.
>
> Mentored-by: Patrick Steinhardt <ps@pks.im>
> Mentored-by: Karthik Nayak <karthik.188@gmail.com>
> Signed-off-by: shejialuo <shejialuo@gmail.com>
> ---
> refs/files-backend.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>