Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-10-18 07:57:37 +0300
committerJunio C Hamano <gitster@pobox.com>2019-10-28 08:05:18 +0300
commit733902905d4db54612fef9755bb31fd35a89e76c (patch)
tree4296300d056b40a89692c756c5ba905f7ea1d3d5 /builtin/fsck.c
parentd40bbc109b6f5d9e5e5088095cc33fef2e25971e (diff)
fsck: use oids rather than objects for object_name API
We don't actually care about having object structs; we only need to look up decorations by oid. Let's accept this more limited form, which will give our callers more flexibility. Note that the decoration API we rely on uses object structs itself (even though it only looks at their oids). We can solve this by switching to a kh_oid_map (we could also use the hashmap oidmap, but it's more awkward for the simple case of just storing a void pointer). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 237643cc1d..66fa727c14 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -52,7 +52,7 @@ static int name_objects;
static const char *describe_object(struct object *obj)
{
- return fsck_describe_object(&fsck_walk_options, obj);
+ return fsck_describe_object(&fsck_walk_options, &obj->oid);
}
static const char *printable_type(struct object *obj)
@@ -483,7 +483,7 @@ static void fsck_handle_reflog_oid(const char *refname, struct object_id *oid,
obj = lookup_object(the_repository, oid);
if (obj && (obj->flags & HAS_OBJ)) {
if (timestamp)
- fsck_put_object_name(&fsck_walk_options, obj,
+ fsck_put_object_name(&fsck_walk_options, oid,
"%s@{%"PRItime"}",
refname, timestamp);
obj->flags |= USED;
@@ -550,7 +550,7 @@ static int fsck_handle_ref(const char *refname, const struct object_id *oid,
default_refs++;
obj->flags |= USED;
fsck_put_object_name(&fsck_walk_options,
- obj, "%s", refname);
+ oid, "%s", refname);
mark_object_reachable(obj);
return 0;
@@ -724,7 +724,7 @@ static int fsck_cache_tree(struct cache_tree *it)
return 1;
}
obj->flags |= USED;
- fsck_put_object_name(&fsck_walk_options, obj, ":");
+ fsck_put_object_name(&fsck_walk_options, &it->oid, ":");
mark_object_reachable(obj);
if (obj->type != OBJ_TREE)
err |= objerror(obj, _("non-tree in cache-tree"));
@@ -869,7 +869,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
}
obj->flags |= USED;
- fsck_put_object_name(&fsck_walk_options, obj,
+ fsck_put_object_name(&fsck_walk_options, &oid,
"%s", arg);
mark_object_reachable(obj);
continue;
@@ -906,7 +906,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
continue;
obj = &blob->object;
obj->flags |= USED;
- fsck_put_object_name(&fsck_walk_options, obj,
+ fsck_put_object_name(&fsck_walk_options, &obj->oid,
":%s", active_cache[i]->name);
mark_object_reachable(obj);
}