summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2017-02-21 23:47:32 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-02-22 10:12:15 -0800
commit9461d27240c158cf781ce706a077663050179b14 (patch)
treeb7cd7ab70db3881689f8afb068c3a4a25f4f5784 /builtin
parentreflog-walk: convert struct reflog_info to struct object_id (diff)
downloadtgif-9461d27240c158cf781ce706a077663050179b14.tar.xz
refs: convert each_reflog_ent_fn to struct object_id
Make each_reflog_ent_fn take two struct object_id pointers instead of two pointers to unsigned char. Convert the various callbacks to use struct object_id as well. Also, rename fsck_handle_reflog_sha1 to fsck_handle_reflog_oid. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fsck.c16
-rw-r--r--builtin/merge-base.c6
-rw-r--r--builtin/reflog.c2
3 files changed, 12 insertions, 12 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 1a5caccd0f..9b37606858 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -396,13 +396,13 @@ static int fsck_obj_buffer(const unsigned char *sha1, enum object_type type,
static int default_refs;
-static void fsck_handle_reflog_sha1(const char *refname, unsigned char *sha1,
+static void fsck_handle_reflog_oid(const char *refname, struct object_id *oid,
unsigned long timestamp)
{
struct object *obj;
- if (!is_null_sha1(sha1)) {
- obj = lookup_object(sha1);
+ if (!is_null_oid(oid)) {
+ obj = lookup_object(oid->hash);
if (obj && (obj->flags & HAS_OBJ)) {
if (timestamp && name_objects)
add_decoration(fsck_walk_options.object_names,
@@ -411,13 +411,13 @@ static void fsck_handle_reflog_sha1(const char *refname, unsigned char *sha1,
obj->used = 1;
mark_object_reachable(obj);
} else {
- error("%s: invalid reflog entry %s", refname, sha1_to_hex(sha1));
+ error("%s: invalid reflog entry %s", refname, oid_to_hex(oid));
errors_found |= ERROR_REACHABLE;
}
}
}
-static int fsck_handle_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
+static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *email, unsigned long timestamp, int tz,
const char *message, void *cb_data)
{
@@ -425,10 +425,10 @@ static int fsck_handle_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
if (verbose)
fprintf(stderr, "Checking reflog %s->%s\n",
- sha1_to_hex(osha1), sha1_to_hex(nsha1));
+ oid_to_hex(ooid), oid_to_hex(noid));
- fsck_handle_reflog_sha1(refname, osha1, 0);
- fsck_handle_reflog_sha1(refname, nsha1, timestamp);
+ fsck_handle_reflog_oid(refname, ooid, 0);
+ fsck_handle_reflog_oid(refname, noid, timestamp);
return 0;
}
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index b572a37c26..db95bc29cf 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -131,7 +131,7 @@ static void add_one_commit(unsigned char *sha1, struct rev_collect *revs)
commit->object.flags |= TMP_MARK;
}
-static int collect_one_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
+static int collect_one_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *ident, unsigned long timestamp,
int tz, const char *message, void *cbdata)
{
@@ -139,9 +139,9 @@ static int collect_one_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
if (revs->initial) {
revs->initial = 0;
- add_one_commit(osha1, revs);
+ add_one_commit(ooid->hash, revs);
}
- add_one_commit(nsha1, revs);
+ add_one_commit(noid->hash, revs);
return 0;
}
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 7a7136e53e..7472775778 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -615,7 +615,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
return status;
}
-static int count_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
+static int count_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *email, unsigned long timestamp, int tz,
const char *message, void *cb_data)
{