summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-02-14 20:54:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-14 20:54:22 (GMT)
commit78e67cda42a440f216fc4cbfd8a9e190c5eece5a (patch)
tree6e1f8349af8dc8ba249a6fd9f4367ef8e983a55d /builtin
parentdf04a316176d5ba44422c2c6b0cb1a9fc31901e5 (diff)
parentb98d18858187eb926912d5199533a6d2a14d5007 (diff)
downloadgit-78e67cda42a440f216fc4cbfd8a9e190c5eece5a.zip
git-78e67cda42a440f216fc4cbfd8a9e190c5eece5a.tar.gz
git-78e67cda42a440f216fc4cbfd8a9e190c5eece5a.tar.bz2
Merge branch 'mt/use-passed-repo-more-in-funcs'
Some codepaths were given a repository instance as a parameter to work in the repository, but passed the_repository instance to its callees, which has been cleaned up (somewhat). * mt/use-passed-repo-more-in-funcs: sha1-file: allow check_object_signature() to handle any repo sha1-file: pass git_hash_algo to hash_object_file() sha1-file: pass git_hash_algo to write_object_file_prepare() streaming: allow open_istream() to handle any repo pack-check: use given repo's hash_algo at verify_packfile() cache-tree: use given repo's hash_algo at verify_one() diff: make diff_populate_filespec() honor its repo argument
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fast-export.c3
-rw-r--r--builtin/index-pack.c10
-rw-r--r--builtin/mktag.c7
-rw-r--r--builtin/pack-objects.c3
-rw-r--r--builtin/replace.c3
-rw-r--r--builtin/unpack-objects.c3
6 files changed, 19 insertions, 10 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 164406f..8586816 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -293,7 +293,8 @@ static void export_blob(const struct object_id *oid)
buf = read_object_file(oid, &type, &size);
if (!buf)
die("could not read blob %s", oid_to_hex(oid));
- if (check_object_signature(oid, buf, size, type_name(type)) < 0)
+ if (check_object_signature(the_repository, oid, buf, size,
+ type_name(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 60a5591..acdda17 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -757,7 +757,8 @@ static int check_collison(struct object_entry *entry)
memset(&data, 0, sizeof(data));
data.entry = entry;
- data.st = open_istream(&entry->idx.oid, &type, &size, NULL);
+ data.st = open_istream(the_repository, &entry->idx.oid, &type, &size,
+ NULL);
if (!data.st)
return -1;
if (size != entry->size || type != entry->type)
@@ -948,7 +949,7 @@ static void resolve_delta(struct object_entry *delta_obj,
free(delta_data);
if (!result->data)
bad_object(delta_obj->idx.offset, _("failed to apply delta"));
- hash_object_file(result->data, result->size,
+ hash_object_file(the_hash_algo, result->data, result->size,
type_name(delta_obj->real_type), &delta_obj->idx.oid);
sha1_object(result->data, NULL, result->size, delta_obj->real_type,
&delta_obj->idx.oid);
@@ -1383,8 +1384,9 @@ static void fix_unresolved_deltas(struct hashfile *f)
if (!base_obj->data)
continue;
- if (check_object_signature(&d->oid, base_obj->data,
- base_obj->size, type_name(type)))
+ if (check_object_signature(the_repository, &d->oid,
+ base_obj->data, base_obj->size,
+ type_name(type)))
die(_("local object %s is corrupt"), oid_to_hex(&d->oid));
base_obj->obj = append_obj_to_pack(f, d->oid.hash,
base_obj->data, base_obj->size, type);
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 6fb7dc8..4982d3a 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -29,8 +29,11 @@ static int verify_object(const struct object_id *oid, const char *expected_type)
const struct object_id *repl = lookup_replace_object(the_repository, oid);
if (buffer) {
- if (type == type_from_string(expected_type))
- ret = check_object_signature(repl, buffer, size, expected_type);
+ if (type == type_from_string(expected_type)) {
+ ret = check_object_signature(the_repository, repl,
+ buffer, size,
+ expected_type);
+ }
free(buffer);
}
return ret;
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index b199820..940fbcb 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -304,7 +304,8 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent
if (!usable_delta) {
if (oe_type(entry) == OBJ_BLOB &&
oe_size_greater_than(&to_pack, entry, big_file_threshold) &&
- (st = open_istream(&entry->idx.oid, &type, &size, NULL)) != NULL)
+ (st = open_istream(the_repository, &entry->idx.oid, &type,
+ &size, NULL)) != NULL)
buf = NULL;
else {
buf = read_object_file(&entry->idx.oid, &type, &size);
diff --git a/builtin/replace.c b/builtin/replace.c
index bd92dc6..b36d17a 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -409,7 +409,8 @@ static int check_one_mergetag(struct commit *commit,
struct tag *tag;
int i;
- hash_object_file(extra->value, extra->len, type_name(OBJ_TAG), &tag_oid);
+ hash_object_file(the_hash_algo, extra->value, extra->len,
+ type_name(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 9100964..dd4a75e 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -265,7 +265,8 @@ static void write_object(unsigned nr, enum object_type type,
} else {
struct object *obj;
int eaten;
- hash_object_file(buf, size, type_name(type), &obj_list[nr].oid);
+ hash_object_file(the_hash_algo, buf, size, type_name(type),
+ &obj_list[nr].oid);
added_object(nr, type, buf, size);
obj = parse_object_buffer(the_repository, &obj_list[nr].oid,
type, size, buf,