read-cache: teach make_cache_entry to take object_id

Teach make_cache_entry function to take object_id instead of a SHA-1.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jameson Miller
2018-07-02 19:49:30 +00:00
committed by Junio C Hamano
parent 768d796506
commit 825ed4d9a0
8 changed files with 18 additions and 11 deletions

View File

@ -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);
oidcpy(&ce->oid, oid);
memcpy(ce->name, path, len);
ce->ce_flags = create_ce_flags(stage);
ce->ce_namelen = len;