builtin/reflog: convert remaining unsigned char uses to object_id

Convert the remaining uses of unsigned char [20] to struct object_id. This conversion is needed for dwim_log. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Oct 15, 2017 at 22:06 UTC b8acac54c8f91e2b677137665a2d750b086875dc
1 file changed +9 -9
builtin/reflog.c
+9 -9
@@ -42,7 +42,7 @@ struct expire_reflog_policy_cb {
42 };
43
44 struct collected_reflog {
45 - unsigned char sha1[20];
45 + struct object_id oid;
46 char reflog[FLEX_ARRAY];
47 };
48
@@ -385,7 +385,7 @@ static int collect_reflog(const char *ref, const struct object_id *oid, int unus
385 struct collect_reflog_cb *cb = cb_data;
386
387 FLEX_ALLOC_STR(e, reflog, ref);
388 - hashcpy(e->sha1, oid->hash);
388 + oidcpy(&e->oid, oid);
389 ALLOC_GROW(cb->e, cb->nr + 1, cb->alloc);
390 cb->e[cb->nr++] = e;
391 return 0;
@@ -589,7 +589,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
589 for (i = 0; i < collected.nr; i++) {
590 struct collected_reflog *e = collected.e[i];
591 set_reflog_expiry_param(&cb.cmd, explicit_expiry, e->reflog);
592 - status |= reflog_expire(e->reflog, e->sha1, flags,
592 + status |= reflog_expire(e->reflog, e->oid.hash, flags,
593 reflog_expiry_prepare,
594 should_expire_reflog_ent,
595 reflog_expiry_cleanup,
@@ -601,13 +601,13 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
601
602 for (; i < argc; i++) {
603 char *ref;
604 - unsigned char sha1[20];
605 - if (!dwim_log(argv[i], strlen(argv[i]), sha1, &ref)) {
604 + struct object_id oid;
605 + if (!dwim_log(argv[i], strlen(argv[i]), oid.hash, &ref)) {
606 status |= error("%s points nowhere!", argv[i]);
607 continue;
608 }
609 set_reflog_expiry_param(&cb.cmd, explicit_expiry, ref);
610 - status |= reflog_expire(ref, sha1, flags,
610 + status |= reflog_expire(ref, oid.hash, flags,
611 reflog_expiry_prepare,
612 should_expire_reflog_ent,
613 reflog_expiry_cleanup,
@@ -659,7 +659,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
659
660 for ( ; i < argc; i++) {
661 const char *spec = strstr(argv[i], "@{");
662 - unsigned char sha1[20];
662 + struct object_id oid;
663 char *ep, *ref;
664 int recno;
665
@@ -668,7 +668,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
668 continue;
669 }
670
671 - if (!dwim_log(argv[i], spec - argv[i], sha1, &ref)) {
671 + if (!dwim_log(argv[i], spec - argv[i], oid.hash, &ref)) {
672 status |= error("no reflog for '%s'", argv[i]);
673 continue;
674 }
@@ -683,7 +683,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
683 cb.cmd.expire_total = 0;
684 }
685
686 - status |= reflog_expire(ref, sha1, flags,
686 + status |= reflog_expire(ref, oid.hash, flags,
687 reflog_expiry_prepare,
688 should_expire_reflog_ent,
689 reflog_expiry_cleanup,