Subject: Re: [PATCH v5 2/8] read-cache: make_cache_entry should take object_id struct

From: SZEDER Gábor <[email-masked]>
Date: Fri, 29 Jun 2018 00:27:44 +0200

> The make_cache_entry function should take an object_id struct instead
> of sha.

> diff --git a/read-cache.c b/read-cache.c
> index fa8366ecab..9624ce1784 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -746,8 +746,10 @@ int add_file_to_index(struct index_state *istate, const char *path, int flags)
>  }
> 
>  struct cache_entry *make_cache_entry(unsigned int mode,
> -		const unsigned char *sha1, const char *path, int stage,
> -		unsigned int refresh_options)
> +				     const struct object_id *oid,
> +				     const char *path,
> +				     int stage,
> +				     unsigned int refresh_options)
>  {
>  	int size, len;
>  	struct cache_entry *ce, *ret;
> @@ -761,7 +763,7 @@ struct cache_entry *make_cache_entry(unsigned int mode,
>  	size = cache_entry_size(len);
>  	ce = xcalloc(1, size);
> 
> -	hashcpy(ce->oid.hash, sha1);
> +	hashcpy(ce->oid.hash, oid->hash);

Speaking of using struct object_id instead of sha, please use oidcpy()
here.