Web lists-archives.com

Re: [PATCH v2 05/24] refs: update ref transactions to use struct object_id




On 10/09/2017 03:11 AM, brian m. carlson wrote:
> Update the ref transaction code to use struct object_id.  Remove one
> NULL pointer check which was previously inserted around a dereference;
> since we now pass a pointer to struct object_id directly through, the
> code we're calling handles this for us.
> 
> Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx>
> ---
>  branch.c               |  2 +-
>  builtin/clone.c        |  2 +-
>  builtin/commit.c       |  4 ++--
>  builtin/fetch.c        |  4 ++--
>  builtin/receive-pack.c |  4 ++--
>  builtin/replace.c      |  2 +-
>  builtin/tag.c          |  2 +-
>  builtin/update-ref.c   |  8 ++++----
>  fast-import.c          |  4 ++--
>  refs.c                 | 44 +++++++++++++++++++++-----------------------
>  refs.h                 | 24 ++++++++++++------------
>  refs/files-backend.c   | 12 ++++++------
>  refs/refs-internal.h   |  4 ++--
>  sequencer.c            |  2 +-
>  walker.c               |  2 +-
>  15 files changed, 59 insertions(+), 61 deletions(-)
> 
> [...]
> diff --git a/refs.h b/refs.h
> index 369614d392..543dcc5956 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -519,15 +519,15 @@ struct ref_transaction *ref_transaction_begin(struct strbuf *err);
>   */
>  int ref_transaction_update(struct ref_transaction *transaction,

The docstring for this function needs to be updated.

>  			   const char *refname,
> -			   const unsigned char *new_sha1,
> -			   const unsigned char *old_sha1,
> +			   const struct object_id *new_oid,
> +			   const struct object_id *old_oid,
>  			   unsigned int flags, const char *msg,
>  			   struct strbuf *err);
>  
> [...]

Michael