Subject: Re: [PATCH v2 37/43] refs: move some defines from refs-be-files.c to refs.h

From: Michael Haggerty <[email-masked]>
Date: Mon, 05 Oct 2015 10:57:34 +0200

On 09/29/2015 12:02 AM, David Turner wrote:
> This allows them to be used by other ref backends.
> 
> Signed-off-by: David Turner <[email-masked]>
> ---
>  refs-be-files.c | 24 ------------------------
>  refs.h          | 24 ++++++++++++++++++++++++
>  2 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/refs-be-files.c b/refs-be-files.c
> index 3bcfab3..2727943 100644
> --- a/refs-be-files.c
> +++ b/refs-be-files.c
> @@ -14,30 +14,6 @@ struct ref_lock {
>  };
>  
>  /*
> - * Flag passed to lock_ref_sha1_basic() telling it to tolerate broken
> - * refs (i.e., because the reference is about to be deleted anyway).
> - */
> -#define REF_DELETING	0x02
> [...]
> diff --git a/refs.h b/refs.h
> index 823983b..d8ae9af 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -193,6 +193,30 @@ struct ref_transaction {
>  #define DO_FOR_EACH_PER_WORKTREE_ONLY 0x02
>  
>  /*
> + * Flag passed to lock_ref_sha1_basic() telling it to tolerate broken
> + * refs (i.e., because the reference is about to be deleted anyway).
> + */
> +#define REF_DELETING	0x02
> [...]

The fact that these constants might be used by multiple reference
backends is not a reason to put them in the ref API's public interface.
We don't want random code using these contants, right?

Maybe there should be a new file pair, refs-be-shared.{c,h}, for
"protected" constants and functions for the internal use of the
reference backends. In fact, maybe `struct ref_be` and the associated
typedefs could even be moved there.

Probably some of the functions that you have made public earlier in this
series could also go into the "protected" area.

Michael

-- 
Michael Haggerty
[email-masked]