From: karthik nayak Date: Mon, 21 Oct 2024 15:49:11 GMT Subject: Re: [PATCH v6 3/9] ref: initialize target name outside of check functions Message-ID: In-Reply-To: shejialuo writes: > 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`? > "target_name", thus whenever we handle a new target, calculate the > name and call the check functions one by one. > > Mentored-by: Patrick Steinhardt > Mentored-by: Karthik Nayak > Signed-off-by: shejialuo > --- > refs/files-backend.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > [snip]