Re: [PATCH v2 16/21] branch: stop modifying `log_all_ref_updates` variable

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

 



On 24/08/30 11:09AM, Patrick Steinhardt wrote:
> In "branch.c" we modify the global `log_all_ref_updates` variable to
> force creation of a reflog entry. Modifying global state like this is
> discouraged, as it may have all kinds of consequences in other places of
> our codebase.
> 
> Stop modifying the variable and pass the `REF_FORCE_CREATE_REFLOG` flag,
> which has the same effect.
> 
> Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
> ---
>  branch.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/branch.c b/branch.c
> index c887ea21514..08fa4094d2b 100644
> --- a/branch.c
> +++ b/branch.c
> @@ -601,6 +601,7 @@ void create_branch(struct repository *r,
>  	int forcing = 0;
>  	struct ref_transaction *transaction;
>  	struct strbuf err = STRBUF_INIT;
> +	int flags = 0;
>  	char *msg;
>  
>  	if (track == BRANCH_TRACK_OVERRIDE)
> @@ -619,7 +620,7 @@ void create_branch(struct repository *r,
>  		goto cleanup;
>  
>  	if (reflog)
> -		log_all_ref_updates = LOG_REFS_NORMAL;
> +		flags |= REF_FORCE_CREATE_REFLOG;

I'm trying to understand how setting the `REF_FORCE_CREATE_REFLOG` flag
is ultimately equivalent to setting `log_all_ref_updates =
LOG_REFS_NORMAL`.


[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