diff: convert struct diff_filespec to struct object_id

Convert struct diff_filespec's sha1 member to use a struct object_id
called "oid" instead.  The following Coccinelle semantic patch was used
to implement this, followed by the transformations in object_id.cocci:

@@
struct diff_filespec o;
@@
- o.sha1
+ o.oid.hash

@@
struct diff_filespec *p;
@@
- p->sha1
+ p->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:
brian m. carlson
2016-06-24 23:09:23 +00:00
committed by Junio C Hamano
parent c368dde924
commit a0d12c4433
13 changed files with 147 additions and 128 deletions

View File

@ -44,9 +44,9 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
memset(p->parent, 0,
sizeof(p->parent[0]) * num_parent);
hashcpy(p->oid.hash, q->queue[i]->two->sha1);
oidcpy(&p->oid, &q->queue[i]->two->oid);
p->mode = q->queue[i]->two->mode;
hashcpy(p->parent[n].oid.hash, q->queue[i]->one->sha1);
oidcpy(&p->parent[n].oid, &q->queue[i]->one->oid);
p->parent[n].mode = q->queue[i]->one->mode;
p->parent[n].status = q->queue[i]->status;
*tail = p;
@ -77,7 +77,7 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
continue;
}
hashcpy(p->parent[n].oid.hash, q->queue[i]->one->sha1);
oidcpy(&p->parent[n].oid, &q->queue[i]->one->oid);
p->parent[n].mode = q->queue[i]->one->mode;
p->parent[n].status = q->queue[i]->status;
@ -1268,7 +1268,7 @@ static struct diff_filepair *combined_pair(struct combine_diff_path *p,
for (i = 0; i < num_parent; i++) {
pair->one[i].path = p->path;
pair->one[i].mode = p->parent[i].mode;
hashcpy(pair->one[i].sha1, p->parent[i].oid.hash);
oidcpy(&pair->one[i].oid, &p->parent[i].oid);
pair->one[i].sha1_valid = !is_null_oid(&p->parent[i].oid);
pair->one[i].has_more_entries = 1;
}
@ -1276,7 +1276,7 @@ static struct diff_filepair *combined_pair(struct combine_diff_path *p,
pair->two->path = p->path;
pair->two->mode = p->mode;
hashcpy(pair->two->sha1, p->oid.hash);
oidcpy(&pair->two->oid, &p->oid);
pair->two->sha1_valid = !is_null_oid(&p->oid);
return pair;
}