Re: [PATCH 23/38] refs: make peel_ref() virtual

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

 



Michael Haggerty <mhagger@xxxxxxxxxxxx> writes:

> For now it only supports the main reference store.

Isn't this comment applicable to a handful of recent changes that
made other things virtual, too?  Just wondering if I am missing
something very special with the peel_ref() thing to single it out.
>
> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx>
> ---
>  refs.c               | 7 +++++++
>  refs/files-backend.c | 6 ++++--
>  refs/refs-internal.h | 3 +++
>  3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 22837f4..2d84c5c 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1425,6 +1425,13 @@ int pack_refs(unsigned int flags)
>  	return refs->be->pack_refs(refs, flags);
>  }
>  
> +int peel_ref(const char *refname, unsigned char *sha1)
> +{
> +	struct ref_store *refs = get_ref_store(NULL);
> +
> +	return refs->be->peel_ref(refs, refname, sha1);
> +}
> +
>  int create_symref(const char *ref_target, const char *refs_heads_master,
>  		  const char *logmsg)
>  {
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index f82a1be..91dcfcb 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -1763,9 +1763,10 @@ static enum peel_status peel_entry(struct ref_entry *entry, int repeel)
>  	return status;
>  }
>  
> -int peel_ref(const char *refname, unsigned char *sha1)
> +static int files_peel_ref(struct ref_store *ref_store,
> +			  const char *refname, unsigned char *sha1)
>  {
> -	struct files_ref_store *refs = get_files_ref_store(NULL, "peel_ref");
> +	struct files_ref_store *refs = files_downcast(ref_store, 0, "peel_ref");
>  	int flag;
>  	unsigned char base[20];
>  
> @@ -4031,6 +4032,7 @@ struct ref_storage_be refs_be_files = {
>  	files_transaction_commit,
>  
>  	files_pack_refs,
> +	files_peel_ref,
>  	files_create_symref,
>  
>  	files_read_raw_ref,
> diff --git a/refs/refs-internal.h b/refs/refs-internal.h
> index c342e57..ae67b49 100644
> --- a/refs/refs-internal.h
> +++ b/refs/refs-internal.h
> @@ -496,6 +496,8 @@ typedef int ref_transaction_commit_fn(struct ref_store *refs,
>  				      struct strbuf *err);
>  
>  typedef int pack_refs_fn(struct ref_store *ref_store, unsigned int flags);
> +typedef int peel_ref_fn(struct ref_store *ref_store,
> +			const char *refname, unsigned char *sha1);
>  typedef int create_symref_fn(struct ref_store *ref_store,
>  			     const char *ref_target,
>  			     const char *refs_heads_master,
> @@ -556,6 +558,7 @@ struct ref_storage_be {
>  	ref_transaction_commit_fn *transaction_commit;
>  
>  	pack_refs_fn *pack_refs;
> +	peel_ref_fn *peel_ref;
>  	create_symref_fn *create_symref;
>  
>  	read_raw_ref_fn *read_raw_ref;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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]