reflog-walk: convert struct reflog_info to struct object_id

Convert struct reflog_info to use struct object_id by changing the structure definition and applying the following semantic patch: @@ struct reflog_info E1; @@ - E1.osha1 + E1.ooid.hash @@ struct reflog_info *E1; @@ - E1->osha1 + E1->ooid.hash @@ struct reflog_info E1; @@ - E1.nsha1 + E1.noid.hash @@ struct reflog_info *E1; @@ - E1->nsha1 + E1->noid.hash Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Feb 21, 2017 at 23:47 UTC 8ebc3fd01bcedcb9a442da1114f37d1a4b8869a0
1 file changed +6 -6
reflog-walk.c
+6 -6
@@ -10,7 +10,7 @@ struct complete_reflogs {
10 char *ref;
11 const char *short_ref;
12 struct reflog_info {
13 - unsigned char osha1[20], nsha1[20];
13 + struct object_id ooid, noid;
14 char *email;
15 unsigned long timestamp;
16 int tz;
@@ -28,8 +28,8 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,
28
29 ALLOC_GROW(array->items, array->nr + 1, array->alloc);
30 item = array->items + array->nr;
31 - hashcpy(item->osha1, osha1);
32 - hashcpy(item->nsha1, nsha1);
31 + hashcpy(item->ooid.hash, osha1);
32 + hashcpy(item->noid.hash, nsha1);
33 item->email = xstrdup(email);
34 item->timestamp = timestamp;
35 item->tz = tz;
@@ -238,13 +238,13 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
238 do {
239 reflog = &commit_reflog->reflogs->items[commit_reflog->recno];
240 commit_reflog->recno--;
241 - logobj = parse_object(reflog->osha1);
241 + logobj = parse_object(reflog->ooid.hash);
242 } while (commit_reflog->recno && (logobj && logobj->type != OBJ_COMMIT));
243
244 - if (!logobj && commit_reflog->recno >= 0 && is_null_sha1(reflog->osha1)) {
244 + if (!logobj && commit_reflog->recno >= 0 && is_null_sha1(reflog->ooid.hash)) {
245 /* a root commit, but there are still more entries to show */
246 reflog = &commit_reflog->reflogs->items[commit_reflog->recno];
247 - logobj = parse_object(reflog->nsha1);
247 + logobj = parse_object(reflog->noid.hash);
248 }
249
250 if (!logobj || logobj->type != OBJ_COMMIT) {