Subject: Re: [PATCH v5 04/16] refs: introduce function to batch refname availability checks

From: shejialuo <[email-masked]>
Date: Wed, 12 Mar 2025 20:44:42 +0800

On Wed, Mar 12, 2025 at 08:36:47PM +0800, shejialuo wrote:
> On Thu, Mar 06, 2025 at 04:08:35PM +0100, Patrick Steinhardt wrote:
> > The `refs_verify_refname_available()` functions checks whether a
> > reference update can be committed or whether it would conflict with
> > either a prefix or suffix thereof. This function needs to be called once
> > per reference that one wants to check, which requires us to redo a
> > couple of checks every time the function is called.
> > 
> > Introduce a new function `refs_verify_refnames_available()` that does
> > the same, but for a list of references. For now, the new function uses
> > the exact same implementation, except that we loop through all refnames
> > provided by the caller. This will be tuned in subsequent commits.
> > 
> 
> After reading this patch, I think we may could add more motivation here.
> What's the advantage of checking batch refname? From my understanding,
> we want to check the group of refnames and if we find one which is not
> good we will just return and we don't need to check further more thus
> avoiding unnecessary checks which improves speed.
> 
> When I read the commit message, I wonder if we will loop through all
> refnames, we still need to handle the same number of refnames. So how do
> we avoid this?
> 
> I think we should make this clear.
> 

I totally misunderstood. After reading the commit message of the next
patch, I have realized that we just simply do a refactor. Ignore my
comment. Sorry.