Skip to content

Commit b8acac5

Browse files
bk2204gitster
authored andcommitted
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>
1 parent cca5fa6 commit b8acac5

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

builtin/reflog.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct expire_reflog_policy_cb {
4242
};
4343

4444
struct collected_reflog {
45-
unsigned char sha1[20];
45+
struct object_id oid;
4646
char reflog[FLEX_ARRAY];
4747
};
4848

@@ -385,7 +385,7 @@ static int collect_reflog(const char *ref, const struct object_id *oid, int unus
385385
struct collect_reflog_cb *cb = cb_data;
386386

387387
FLEX_ALLOC_STR(e, reflog, ref);
388-
hashcpy(e->sha1, oid->hash);
388+
oidcpy(&e->oid, oid);
389389
ALLOC_GROW(cb->e, cb->nr + 1, cb->alloc);
390390
cb->e[cb->nr++] = e;
391391
return 0;
@@ -589,7 +589,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
589589
for (i = 0; i < collected.nr; i++) {
590590
struct collected_reflog *e = collected.e[i];
591591
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,
593593
reflog_expiry_prepare,
594594
should_expire_reflog_ent,
595595
reflog_expiry_cleanup,
@@ -601,13 +601,13 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
601601

602602
for (; i < argc; i++) {
603603
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)) {
606606
status |= error("%s points nowhere!", argv[i]);
607607
continue;
608608
}
609609
set_reflog_expiry_param(&cb.cmd, explicit_expiry, ref);
610-
status |= reflog_expire(ref, sha1, flags,
610+
status |= reflog_expire(ref, oid.hash, flags,
611611
reflog_expiry_prepare,
612612
should_expire_reflog_ent,
613613
reflog_expiry_cleanup,
@@ -659,7 +659,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
659659

660660
for ( ; i < argc; i++) {
661661
const char *spec = strstr(argv[i], "@{");
662-
unsigned char sha1[20];
662+
struct object_id oid;
663663
char *ep, *ref;
664664
int recno;
665665

@@ -668,7 +668,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
668668
continue;
669669
}
670670

671-
if (!dwim_log(argv[i], spec - argv[i], sha1, &ref)) {
671+
if (!dwim_log(argv[i], spec - argv[i], oid.hash, &ref)) {
672672
status |= error("no reflog for '%s'", argv[i]);
673673
continue;
674674
}
@@ -683,7 +683,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
683683
cb.cmd.expire_total = 0;
684684
}
685685

686-
status |= reflog_expire(ref, sha1, flags,
686+
status |= reflog_expire(ref, oid.hash, flags,
687687
reflog_expiry_prepare,
688688
should_expire_reflog_ent,
689689
reflog_expiry_cleanup,

0 commit comments

Comments
 (0)