Skip to content

Commit fcb6df3

Browse files
committed
Merge branch 'sb/oid-object-info'
The codepath around object-info API has been taught to take the repository object (which in turn tells the API which object store the objects are to be located). * sb/oid-object-info: cache.h: allow oid_object_info to handle arbitrary repositories packfile: add repository argument to cache_or_unpack_entry packfile: add repository argument to unpack_entry packfile: add repository argument to read_object packfile: add repository argument to packed_object_info packfile: add repository argument to packed_to_object_type packfile: add repository argument to retry_bad_packed_offset cache.h: add repository argument to oid_object_info cache.h: add repository argument to oid_object_info_extended
2 parents d0f7b22 + 9d98354 commit fcb6df3

36 files changed

+125
-94
lines changed

archive-tar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static int write_tar_entry(struct archiver_args *args,
276276
memcpy(header.name, path, pathlen);
277277

278278
if (S_ISREG(mode) && !args->convert &&
279-
oid_object_info(oid, &size) == OBJ_BLOB &&
279+
oid_object_info(the_repository, oid, &size) == OBJ_BLOB &&
280280
size > big_file_threshold)
281281
buffer = NULL;
282282
else if (S_ISLNK(mode) || S_ISREG(mode)) {

archive-zip.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ static int write_zip_entry(struct archiver_args *args,
325325
compressed_size = 0;
326326
buffer = NULL;
327327
} else if (S_ISREG(mode) || S_ISLNK(mode)) {
328-
enum object_type type = oid_object_info(oid, &size);
328+
enum object_type type = oid_object_info(the_repository, oid,
329+
&size);
329330

330331
method = 0;
331332
attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) :

blame.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static void verify_working_tree_path(struct commit *work_tree, const char *path)
8181
unsigned mode;
8282

8383
if (!get_tree_entry(commit_oid, path, &blob_oid, &mode) &&
84-
oid_object_info(&blob_oid, NULL) == OBJ_BLOB)
84+
oid_object_info(the_repository, &blob_oid, NULL) == OBJ_BLOB)
8585
return;
8686
}
8787

@@ -504,7 +504,7 @@ static int fill_blob_sha1_and_mode(struct blame_origin *origin)
504504
return 0;
505505
if (get_tree_entry(&origin->commit->object.oid, origin->path, &origin->blob_oid, &origin->mode))
506506
goto error_out;
507-
if (oid_object_info(&origin->blob_oid, NULL) != OBJ_BLOB)
507+
if (oid_object_info(the_repository, &origin->blob_oid, NULL) != OBJ_BLOB)
508508
goto error_out;
509509
return 0;
510510
error_out:

builtin/blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ static int is_a_rev(const char *name)
655655

656656
if (get_oid(name, &oid))
657657
return 0;
658-
return OBJ_NONE < oid_object_info(&oid, NULL);
658+
return OBJ_NONE < oid_object_info(the_repository, &oid, NULL);
659659
}
660660

661661
int cmd_blame(int argc, const char **argv, const char *prefix)

builtin/cat-file.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
7777
switch (opt) {
7878
case 't':
7979
oi.type_name = &sb;
80-
if (oid_object_info_extended(&oid, &oi, flags) < 0)
80+
if (oid_object_info_extended(the_repository, &oid, &oi, flags) < 0)
8181
die("git cat-file: could not get object info");
8282
if (sb.len) {
8383
printf("%s\n", sb.buf);
@@ -88,7 +88,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
8888

8989
case 's':
9090
oi.sizep = &size;
91-
if (oid_object_info_extended(&oid, &oi, flags) < 0)
91+
if (oid_object_info_extended(the_repository, &oid, &oi, flags) < 0)
9292
die("git cat-file: could not get object info");
9393
printf("%lu\n", size);
9494
return 0;
@@ -116,7 +116,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
116116
/* else fallthrough */
117117

118118
case 'p':
119-
type = oid_object_info(&oid, NULL);
119+
type = oid_object_info(the_repository, &oid, NULL);
120120
if (type < 0)
121121
die("Not a valid object name %s", obj_name);
122122

@@ -140,7 +140,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
140140
case 0:
141141
if (type_from_string(exp_type) == OBJ_BLOB) {
142142
struct object_id blob_oid;
143-
if (oid_object_info(&oid, NULL) == OBJ_TAG) {
143+
if (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) {
144144
char *buffer = read_object_file(&oid, &type,
145145
&size);
146146
const char *target;
@@ -151,7 +151,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
151151
} else
152152
oidcpy(&blob_oid, &oid);
153153

154-
if (oid_object_info(&blob_oid, NULL) == OBJ_BLOB)
154+
if (oid_object_info(the_repository, &blob_oid, NULL) == OBJ_BLOB)
155155
return stream_blob_to_fd(1, &blob_oid, NULL, 0);
156156
/*
157157
* we attempted to dereference a tag to a blob
@@ -342,7 +342,7 @@ static void batch_object_write(const char *obj_name, struct batch_options *opt,
342342
struct strbuf buf = STRBUF_INIT;
343343

344344
if (!data->skip_object_info &&
345-
oid_object_info_extended(&data->oid, &data->info,
345+
oid_object_info_extended(the_repository, &data->oid, &data->info,
346346
OBJECT_INFO_LOOKUP_REPLACE) < 0) {
347347
printf("%s missing\n",
348348
obj_name ? obj_name : oid_to_hex(&data->oid));

builtin/describe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static void describe(const char *arg, int last_one)
502502

503503
if (cmit)
504504
describe_commit(&oid, &sb);
505-
else if (oid_object_info(&oid, NULL) == OBJ_BLOB)
505+
else if (oid_object_info(the_repository, &oid, NULL) == OBJ_BLOB)
506506
describe_blob(oid, &sb);
507507
else
508508
die(_("%s is neither a commit nor blob"), arg);

builtin/fast-export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ static void import_marks(char *input_file)
950950
if (last_idnum < mark)
951951
last_idnum = mark;
952952

953-
type = oid_object_info(&oid, NULL);
953+
type = oid_object_info(the_repository, &oid, NULL);
954954
if (type < 0)
955955
die("object not found: %s", oid_to_hex(&oid));
956956

builtin/fetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ static int update_local_ref(struct ref *ref,
656656
struct branch *current_branch = branch_get(NULL);
657657
const char *pretty_ref = prettify_refname(ref->name);
658658

659-
type = oid_object_info(&ref->new_oid, NULL);
659+
type = oid_object_info(the_repository, &ref->new_oid, NULL);
660660
if (type < 0)
661661
die(_("object %s not found"), oid_to_hex(&ref->new_oid));
662662

builtin/fsck.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ static const char *printable_type(struct object *obj)
6767
const char *ret;
6868

6969
if (obj->type == OBJ_NONE) {
70-
enum object_type type = oid_object_info(&obj->oid, NULL);
70+
enum object_type type = oid_object_info(the_repository,
71+
&obj->oid, NULL);
7172
if (type > 0)
7273
object_as_type(obj, type, 0);
7374
}

builtin/index-pack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static unsigned check_object(struct object *obj)
223223

224224
if (!(obj->flags & FLAG_CHECKED)) {
225225
unsigned long size;
226-
int type = oid_object_info(&obj->oid, &size);
226+
int type = oid_object_info(the_repository, &obj->oid, &size);
227227
if (type <= 0)
228228
die(_("did not receive expected object %s"),
229229
oid_to_hex(&obj->oid));
@@ -812,7 +812,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
812812
enum object_type has_type;
813813
unsigned long has_size;
814814
read_lock();
815-
has_type = oid_object_info(oid, &has_size);
815+
has_type = oid_object_info(the_repository, oid, &has_size);
816816
if (has_type < 0)
817817
die(_("cannot read existing object info %s"), oid_to_hex(oid));
818818
if (has_type != type || has_size != size)

0 commit comments

Comments
 (0)