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 <sand...@crustytoothpaste.net>
---
 reflog-walk.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/reflog-walk.c b/reflog-walk.c
index f98748e2ae..fe5be41471 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -10,7 +10,7 @@ struct complete_reflogs {
        char *ref;
        const char *short_ref;
        struct reflog_info {
-               unsigned char osha1[20], nsha1[20];
+               struct object_id ooid, noid;
                char *email;
                unsigned long timestamp;
                int tz;
@@ -28,8 +28,8 @@ static int read_one_reflog(unsigned char *osha1, unsigned 
char *nsha1,
 
        ALLOC_GROW(array->items, array->nr + 1, array->alloc);
        item = array->items + array->nr;
-       hashcpy(item->osha1, osha1);
-       hashcpy(item->nsha1, nsha1);
+       hashcpy(item->ooid.hash, osha1);
+       hashcpy(item->noid.hash, nsha1);
        item->email = xstrdup(email);
        item->timestamp = timestamp;
        item->tz = tz;
@@ -238,13 +238,13 @@ void fake_reflog_parent(struct reflog_walk_info *info, 
struct commit *commit)
        do {
                reflog = &commit_reflog->reflogs->items[commit_reflog->recno];
                commit_reflog->recno--;
-               logobj = parse_object(reflog->osha1);
+               logobj = parse_object(reflog->ooid.hash);
        } while (commit_reflog->recno && (logobj && logobj->type != 
OBJ_COMMIT));
 
-       if (!logobj && commit_reflog->recno >= 0 && 
is_null_sha1(reflog->osha1)) {
+       if (!logobj && commit_reflog->recno >= 0 && 
is_null_sha1(reflog->ooid.hash)) {
                /* a root commit, but there are still more entries to show */
                reflog = &commit_reflog->reflogs->items[commit_reflog->recno];
-               logobj = parse_object(reflog->nsha1);
+               logobj = parse_object(reflog->noid.hash);
        }
 
        if (!logobj || logobj->type != OBJ_COMMIT) {
-- 
2.11.0

Reply via email to