Subject: Re: [PATCH v2 4/5] refs: drop force_create argument of create_reflog API

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Tue, 07 Sep 2021 00:42:26 +0200

On Mon, Sep 06 2021, Han-Wen Nienhuys via GitGitGadget wrote:

> From: Han-Wen Nienhuys <[email-masked]>
>
> There is only one caller, builtin/checkout.c, and it hardcodes
> force_create=1.

Was it ever needed? A glance at abd0cd3a301 (refs: new public ref
function: safe_create_reflog, 2015-07-21) suggests probably not, but
then there's 0f2a71d9923 (refs: add REF_FORCE_CREATE_REFLOG flag,
2015-07-21) ...
 
> [...]
> -static int files_create_reflog(struct ref_store *ref_store,
> -			       const char *refname, int force_create,
> +static int files_create_reflog(struct ref_store *ref_store, const char *refname,
>  			       struct strbuf *err)
>  {
>  	struct files_ref_store *refs =
>  		files_downcast(ref_store, REF_STORE_WRITE, "create_reflog");
>  	int fd;
>  
> -	if (log_ref_setup(refs, refname, force_create, &fd, err))
> +	if (log_ref_setup(refs, refname, /*force_create=*/1, &fd, err))

We can lose the inline comment here & let the function definition speak
for itself, we usually don't inline comment boolean flags.

In any case, having not dug (but presumably you have) some overview of
how we ended up having this not-required flag would be nice. I.e. was it
always this dead-end, or did we replace it with REF_FORCE_CREATE_REFLOG
at some point etc?