Web lists-archives.com

Re: [PATCH v2 21/24] refs: convert resolve_ref_unsafe to struct object_id




On 10/09/2017 03:11 AM, brian m. carlson wrote:
> Convert resolve_ref_unsafe to take a pointer to struct object_id by
> converting one remaining caller to use struct object_id, converting the
> declaration and definition, and applying the following semantic patch:
> 
> @@
> expression E1, E2, E3, E4;
> @@
> - resolve_ref_unsafe(E1, E2, E3.hash, E4)
> + resolve_ref_unsafe(E1, E2, &E3, E4)
> 
> @@
> expression E1, E2, E3, E4;
> @@
> - resolve_ref_unsafe(E1, E2, E3->hash, E4)
> + resolve_ref_unsafe(E1, E2, E3, E4)
> 
> Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx>
> ---
>  blame.c                   |  4 ++--
>  builtin/fsck.c            |  2 +-
>  refs.c                    | 28 ++++++++++++++--------------
>  refs.h                    |  4 ++--
>  refs/files-backend.c      |  8 ++++----
>  sequencer.c               |  2 +-
>  t/helper/test-ref-store.c |  6 +++---
>  transport-helper.c        |  7 +++----
>  worktree.c                |  2 +-
>  9 files changed, 31 insertions(+), 32 deletions(-)
> 
> [...]
> diff --git a/refs.h b/refs.h
> index bb0dcd97af..4eedc880c6 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -62,10 +62,10 @@ struct worktree;

The docstring above this hunk needs to be adjusted.

>  const char *refs_resolve_ref_unsafe(struct ref_store *refs,
>  				    const char *refname,
>  				    int resolve_flags,
> -				    unsigned char *sha1,
> +				    struct object_id *oid,
>  				    int *flags);
>  const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
> -			       unsigned char *sha1, int *flags);
> +			       struct object_id *oid, int *flags);
>  
>  char *refs_resolve_refdup(struct ref_store *refs,
>  			  const char *refname, int resolve_flags,
> [...]
Michael