On 09/29/2015 12:01 AM, David Turner wrote:
> From: Ronnie Sahlberg <sahlb...@google.com>
> 
> Add a ref structure for backend methods. Start by adding method pointers
> for the transaction functions.
> 
> Add a function set_refs_backend to switch between backends. The files
> based backend is the default.
> 
> Signed-off-by: Ronnie Sahlberg <sahlb...@google.com>
> Signed-off-by: David Turner <dtur...@twopensource.com>
> ---
>  refs-be-files.c | 62 +++++++++++++++++++++++++++-------------------
>  refs.c          | 77 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  refs.h          | 36 +++++++++++++++++++++++++++
>  3 files changed, 150 insertions(+), 25 deletions(-)
> 
> [...]
> diff --git a/refs.h b/refs.h
> index 729bc3c..a1db3ef 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -530,4 +530,40 @@ extern int reflog_expire(const char *refname, const 
> unsigned char *sha1,
>                        reflog_expiry_cleanup_fn cleanup_fn,
>                        void *policy_cb_data);
>  
> +/* refs backends */
> +typedef struct ref_transaction *(*ref_transaction_begin_fn)(struct strbuf 
> *err);

Hmmm, I thought our convention was to define typedefs for functions
themselves, not for the pointer-to-function; e.g.,

    typedef struct ref_transaction *ref_transaction_begin_fn(struct
strbuf *err);

(which would require `struct ref_be` to be changed to

        ref_transaction_begin_fn *transaction_begin;

etc.) But now as I grep through the code it looks like both conventions
are used. So never mind :-)

> +typedef int (*ref_transaction_update_fn)(struct ref_transaction *transaction,
> +             const char *refname, const unsigned char *new_sha1,
> +             const unsigned char *old_sha1, unsigned int flags,
> +             const char *msg, struct strbuf *err);
> +typedef int (*ref_transaction_create_fn)(
> +             struct ref_transaction *transaction,
> +             const char *refname, const unsigned char *new_sha1,
> +             unsigned int flags, const char *msg, struct strbuf *err);
> +typedef int (*ref_transaction_delete_fn)(struct ref_transaction *transaction,
> +             const char *refname, const unsigned char *old_sha1,
> +             unsigned int flags, const char *msg, struct strbuf *err);
> +typedef int (*ref_transaction_verify_fn)(struct ref_transaction *transaction,
> +             const char *refname, const unsigned char *old_sha1,
> +             unsigned int flags, struct strbuf *err);
> +typedef int (*ref_transaction_commit_fn)(struct ref_transaction *transaction,
> +                                  struct strbuf *err);
> +typedef void (*ref_transaction_free_fn)(struct ref_transaction *transaction);
> +
> +struct ref_be {
> +     struct ref_be *next;
> +     const char *name;
> +     ref_transaction_begin_fn transaction_begin;
> +     ref_transaction_update_fn transaction_update;
> +     ref_transaction_create_fn transaction_create;
> +     ref_transaction_delete_fn transaction_delete;
> +     ref_transaction_verify_fn transaction_verify;
> +     ref_transaction_commit_fn transaction_commit;
> +     ref_transaction_free_fn transaction_free;
> +};
> +
> +
> +extern struct ref_be refs_be_files;
> +int set_refs_backend(const char *name);
> +
>  #endif /* REFS_H */
> 

Michael

-- 
Michael Haggerty
mhag...@alum.mit.edu

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to