cache: convert struct cache_entry to use struct object_id
Convert struct cache_entry to use struct object_id by applying the following semantic patch and the object_id transforms from contrib, plus the actual change to the struct: @@ struct cache_entry E1; @@ - E1.sha1 + E1.oid.hash @@ struct cache_entry *E1; @@ - E1->sha1 + E1->oid.hash Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
6ebdac1bab
commit
99d1a9861a
@ -275,7 +275,7 @@ static int add_one_path(const struct cache_entry *old, const char *path, int len
|
||||
fill_stat_cache_info(ce, st);
|
||||
ce->ce_mode = ce_mode_from_stat(old, st->st_mode);
|
||||
|
||||
if (index_path(ce->sha1, path, st,
|
||||
if (index_path(ce->oid.hash, path, st,
|
||||
info_only ? 0 : HASH_WRITE_OBJECT)) {
|
||||
free(ce);
|
||||
return -1;
|
||||
@ -403,7 +403,7 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1,
|
||||
size = cache_entry_size(len);
|
||||
ce = xcalloc(1, size);
|
||||
|
||||
hashcpy(ce->sha1, sha1);
|
||||
hashcpy(ce->oid.hash, sha1);
|
||||
memcpy(ce->name, path, len);
|
||||
ce->ce_flags = create_ce_flags(stage);
|
||||
ce->ce_namelen = len;
|
||||
@ -601,7 +601,7 @@ static struct cache_entry *read_one_ent(const char *which,
|
||||
size = cache_entry_size(namelen);
|
||||
ce = xcalloc(1, size);
|
||||
|
||||
hashcpy(ce->sha1, sha1);
|
||||
hashcpy(ce->oid.hash, sha1);
|
||||
memcpy(ce->name, path, namelen);
|
||||
ce->ce_flags = create_ce_flags(stage);
|
||||
ce->ce_namelen = namelen;
|
||||
@ -658,7 +658,7 @@ static int unresolve_one(const char *path)
|
||||
ret = -1;
|
||||
goto free_return;
|
||||
}
|
||||
if (!hashcmp(ce_2->sha1, ce_3->sha1) &&
|
||||
if (!oidcmp(&ce_2->oid, &ce_3->oid) &&
|
||||
ce_2->ce_mode == ce_3->ce_mode) {
|
||||
fprintf(stderr, "%s: identical in both, skipping.\n",
|
||||
path);
|
||||
@ -743,7 +743,7 @@ static int do_reupdate(int ac, const char **av,
|
||||
old = read_one_ent(NULL, head_sha1,
|
||||
ce->name, ce_namelen(ce), 0);
|
||||
if (old && ce->ce_mode == old->ce_mode &&
|
||||
!hashcmp(ce->sha1, old->sha1)) {
|
||||
!oidcmp(&ce->oid, &old->oid)) {
|
||||
free(old);
|
||||
continue; /* unchanged */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user