summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2022-02-05 00:48:32 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-02-25 17:16:32 -0800
commit44439c1c5827480f68b37c3cc38f257eaeb3ed2c (patch)
tree405962dbb5c68dbc18a2082a066c75a21a669b1d /builtin
parentobject API: rename hash_object_file_literally() to write_*() (diff)
downloadtgif-44439c1c5827480f68b37c3cc38f257eaeb3ed2c.tar.xz
object-file API: have hash_object_file() take "enum object_type"
Change the hash_object_file() function to take an "enum object_type". Since a preceding commit all of its callers are passing either "{commit,tree,blob,tag}_type", or the result of a call to type_name(), the parse_object() caller that would pass NULL is now using stream_object_signature(). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fast-export.c2
-rw-r--r--builtin/index-pack.c4
-rw-r--r--builtin/mktag.c2
-rw-r--r--builtin/replace.c2
-rw-r--r--builtin/unpack-objects.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 319859db30..52aebeb521 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -300,7 +300,7 @@ static void export_blob(const struct object_id *oid)
if (!buf)
die("could not read blob %s", oid_to_hex(oid));
if (check_object_signature(the_repository, oid, buf, size,
- type_name(type)) < 0)
+ type) < 0)
die("oid mismatch in blob %s", oid_to_hex(oid));
object = parse_object_buffer(the_repository, oid, type,
size, buf, &eaten);
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index e1927205a7..d0c3e0966b 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -970,7 +970,7 @@ static struct base_data *resolve_delta(struct object_entry *delta_obj,
if (!result_data)
bad_object(delta_obj->idx.offset, _("failed to apply delta"));
hash_object_file(the_hash_algo, result_data, result_size,
- type_name(delta_obj->real_type), &delta_obj->idx.oid);
+ delta_obj->real_type, &delta_obj->idx.oid);
sha1_object(result_data, NULL, result_size, delta_obj->real_type,
&delta_obj->idx.oid);
@@ -1413,7 +1413,7 @@ static void fix_unresolved_deltas(struct hashfile *f)
continue;
if (check_object_signature(the_repository, &d->oid, data, size,
- type_name(type)) < 0)
+ type) < 0)
die(_("local object %s is corrupt"), oid_to_hex(&d->oid));
/*
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 4d28eceeba..14b9fe3bc0 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -62,7 +62,7 @@ static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type)
repl = lookup_replace_object(the_repository, tagged_oid);
ret = check_object_signature(the_repository, repl, buffer, size,
- type_name(*tagged_type));
+ *tagged_type);
free(buffer);
return ret;
diff --git a/builtin/replace.c b/builtin/replace.c
index 995ca68330..53a3b24657 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -409,7 +409,7 @@ static int check_one_mergetag(struct commit *commit,
int i;
hash_object_file(the_hash_algo, extra->value, extra->len,
- type_name(OBJ_TAG), &tag_oid);
+ OBJ_TAG, &tag_oid);
tag = lookup_tag(the_repository, &tag_oid);
if (!tag)
return error(_("bad mergetag in commit '%s'"), ref);
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 808041551f..dbeb0680a5 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -266,7 +266,7 @@ static void write_object(unsigned nr, enum object_type type,
} else {
struct object *obj;
int eaten;
- hash_object_file(the_hash_algo, buf, size, type_name(type),
+ hash_object_file(the_hash_algo, buf, size, type,
&obj_list[nr].oid);
added_object(nr, type, buf, size);
obj = parse_object_buffer(the_repository, &obj_list[nr].oid,