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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> From: Han-Wen Nienhuys <hanwen@xxxxxxxxxx>
>
> 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?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux