Skip to content

Commit 916bb18

Browse files
committed
Merge 'objects-larger-than-4gb-on-windows-pt2'
This is hidden in v2.55.0-rc0's own CI because of an omission in 5ba8291 (ci: enable EXPENSIVE for contributor builds, 2026-05-11) which fails to enable EXPENSIVE tests for tags. Due to 7d78d5f (ci: skip GitHub workflow runs for already-tested commits/trees, 2020-10-08), the CI of `master` is now also mistakenly green because it reuses the tag's CI run to prove that it's solid. This is an evil merge by necessity because `survey.c` needs to adapt to the changed function signatures. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 parents 08500dd + f3aeae9 commit 916bb18

73 files changed

Lines changed: 298 additions & 249 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apply.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3232,7 +3232,7 @@ static int apply_binary_fragment(struct apply_state *state,
32323232
struct patch *patch)
32333233
{
32343234
struct fragment *fragment = patch->fragments;
3235-
unsigned long len;
3235+
size_t len;
32363236
void *dst;
32373237

32383238
if (!fragment)
@@ -3321,7 +3321,7 @@ static int apply_binary(struct apply_state *state,
33213321
if (odb_has_object(the_repository->objects, &oid, 0)) {
33223322
/* We already have the postimage */
33233323
enum object_type type;
3324-
unsigned long size;
3324+
size_t size;
33253325
char *result;
33263326

33273327
result = odb_read_object(the_repository->objects, &oid,
@@ -3384,7 +3384,7 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns
33843384
strbuf_addf(buf, "Subproject commit %s\n", oid_to_hex(oid));
33853385
} else {
33863386
enum object_type type;
3387-
unsigned long sz;
3387+
size_t sz;
33883388
char *result;
33893389

33903390
result = odb_read_object(the_repository->objects, oid,
@@ -3611,7 +3611,7 @@ static int load_preimage(struct apply_state *state,
36113611

36123612
static int resolve_to(struct image *image, const struct object_id *result_id)
36133613
{
3614-
unsigned long size;
3614+
size_t size;
36153615
enum object_type type;
36163616
char *data;
36173617

‎archive.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static void *object_file_to_archive(const struct archiver_args *args,
8787
const struct object_id *oid,
8888
unsigned int mode,
8989
enum object_type *type,
90-
unsigned long *sizep)
90+
size_t *sizep)
9191
{
9292
void *buffer;
9393
const struct commit *commit = args->convert ? args->commit : NULL;
@@ -158,7 +158,7 @@ static int write_archive_entry(const struct object_id *oid, const char *base,
158158
write_archive_entry_fn_t write_entry = c->write_entry;
159159
int err;
160160
const char *path_without_prefix;
161-
unsigned long size;
161+
size_t size;
162162
void *buffer;
163163
enum object_type type;
164164

‎attr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ static struct attr_stack *read_attr_from_blob(struct index_state *istate,
768768
const char *path, unsigned flags)
769769
{
770770
struct object_id oid;
771-
unsigned long sz;
771+
size_t sz;
772772
enum object_type type;
773773
void *buf;
774774
unsigned short mode;

‎bisect.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static void show_list(const char *debug, int counted, int nr,
154154
struct commit *commit = p->item;
155155
unsigned commit_flags = commit->object.flags;
156156
enum object_type type;
157-
unsigned long size;
157+
size_t size;
158158
char *buf = odb_read_object(the_repository->objects,
159159
&commit->object.oid, &type,
160160
&size);

‎blame.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,10 +1041,13 @@ static void fill_origin_blob(struct diff_options *opt,
10411041
textconv_object(opt->repo, o->path, o->mode,
10421042
&o->blob_oid, 1, &file->ptr, &file_size))
10431043
;
1044-
else
1044+
else {
1045+
size_t file_size_st = 0;
10451046
file->ptr = odb_read_object(the_repository->objects,
10461047
&o->blob_oid, &type,
1047-
&file_size);
1048+
&file_size_st);
1049+
file_size = cast_size_t_to_ulong(file_size_st);
1050+
}
10481051
file->size = file_size;
10491052

10501053
if (!file->ptr)
@@ -2869,10 +2872,14 @@ void setup_scoreboard(struct blame_scoreboard *sb,
28692872
textconv_object(sb->repo, sb->path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
28702873
&sb->final_buf_size))
28712874
;
2872-
else
2875+
else {
2876+
size_t final_buf_size_st = 0;
28732877
sb->final_buf = odb_read_object(the_repository->objects,
28742878
&o->blob_oid, &type,
2875-
&sb->final_buf_size);
2879+
&final_buf_size_st);
2880+
sb->final_buf_size =
2881+
cast_size_t_to_ulong(final_buf_size_st);
2882+
}
28762883

28772884
if (!sb->final_buf)
28782885
die(_("cannot read blob %s for path %s"),

‎builtin/cat-file.c‎

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static char *replace_idents_using_mailmap(char *object_buf, size_t *size)
8484

8585
static int filter_object(const char *path, unsigned mode,
8686
const struct object_id *oid,
87-
char **buf, unsigned long *size)
87+
char **buf, size_t *size)
8888
{
8989
enum object_type type;
9090

@@ -120,7 +120,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
120120
struct object_id oid;
121121
enum object_type type;
122122
char *buf;
123-
unsigned long size;
123+
size_t size;
124124
struct object_context obj_context = {0};
125125
struct object_info oi = OBJECT_INFO_INIT;
126126
unsigned flags = OBJECT_INFO_LOOKUP_REPLACE;
@@ -166,7 +166,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
166166
if (use_mailmap && (type == OBJ_COMMIT || type == OBJ_TAG)) {
167167
size_t s = size;
168168
buf = replace_idents_using_mailmap(buf, &s);
169-
size = cast_size_t_to_ulong(s);
169+
size = s;
170170
}
171171

172172
printf("%"PRIuMAX"\n", (uintmax_t)size);
@@ -188,9 +188,15 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
188188
break;
189189

190190
case 'c':
191-
if (textconv_object(the_repository, path, obj_context.mode,
192-
&oid, 1, &buf, &size))
191+
{
192+
unsigned long size_ul = 0;
193+
int textconv_ret = textconv_object(the_repository, path,
194+
obj_context.mode, &oid, 1,
195+
&buf, &size_ul);
196+
size = size_ul;
197+
if (textconv_ret)
193198
break;
199+
}
194200
/* else fallthrough */
195201

196202
case 'p':
@@ -219,7 +225,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
219225
if (use_mailmap) {
220226
size_t s = size;
221227
buf = replace_idents_using_mailmap(buf, &s);
222-
size = cast_size_t_to_ulong(s);
228+
size = s;
223229
}
224230

225231
/* otherwise just spit out the data */
@@ -266,7 +272,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
266272
if (use_mailmap) {
267273
size_t s = size;
268274
buf = replace_idents_using_mailmap(buf, &s);
269-
size = cast_size_t_to_ulong(s);
275+
size = s;
270276
}
271277
break;
272278
}
@@ -288,7 +294,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
288294
struct expand_data {
289295
struct object_id oid;
290296
enum object_type type;
291-
unsigned long size;
297+
size_t size;
292298
unsigned short mode;
293299
off_t disk_size;
294300
const char *rest;
@@ -404,7 +410,7 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
404410
fflush(stdout);
405411
if (opt->transform_mode) {
406412
char *contents;
407-
unsigned long size;
413+
size_t size;
408414

409415
if (!data->rest)
410416
die("missing path for '%s'", oid_to_hex(oid));
@@ -416,9 +422,12 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
416422
oid_to_hex(oid), data->rest);
417423
} else if (opt->transform_mode == 'c') {
418424
enum object_type type;
419-
if (!textconv_object(the_repository,
420-
data->rest, 0100644, oid,
421-
1, &contents, &size))
425+
unsigned long size_ul = 0;
426+
if (textconv_object(the_repository,
427+
data->rest, 0100644, oid,
428+
1, &contents, &size_ul))
429+
size = size_ul;
430+
else
422431
contents = odb_read_object(the_repository->objects,
423432
oid, &type, &size);
424433
if (!contents)
@@ -434,7 +443,7 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
434443
}
435444
else {
436445
enum object_type type;
437-
unsigned long size;
446+
size_t size;
438447
void *contents;
439448

440449
contents = odb_read_object(the_repository->objects, oid,
@@ -445,7 +454,7 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
445454
if (use_mailmap) {
446455
size_t s = size;
447456
contents = replace_idents_using_mailmap(contents, &s);
448-
size = cast_size_t_to_ulong(s);
457+
size = s;
449458
}
450459

451460
if (type != data->type)
@@ -554,7 +563,7 @@ static void batch_object_write(const char *obj_name,
554563
if (!buf)
555564
die(_("unable to read %s"), oid_to_hex(&data->oid));
556565
buf = replace_idents_using_mailmap(buf, &s);
557-
data->size = cast_size_t_to_ulong(s);
566+
data->size = s;
558567

559568
free(buf);
560569
}

‎builtin/difftool.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static char *get_symlink(struct repository *repo,
319319
data = strbuf_detach(&link, NULL);
320320
} else {
321321
enum object_type type;
322-
unsigned long size;
322+
size_t size;
323323
data = odb_read_object(repo->objects, oid, &type, &size);
324324
if (!data)
325325
die(_("could not read object %s for symlink %s"),

‎builtin/fast-export.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ static void export_blob(const struct object_id *oid)
317317
object = (struct object *)lookup_blob(the_repository, oid);
318318
eaten = 0;
319319
} else {
320-
buf = odb_read_object(the_repository->objects, oid, &type, &size);
320+
size_t size_st = 0;
321+
buf = odb_read_object(the_repository->objects, oid, &type,
322+
&size_st);
323+
size = cast_size_t_to_ulong(size_st);
321324
if (!buf)
322325
die(_("could not read blob %s"), oid_to_hex(oid));
323326
if (check_object_signature(the_repository, oid, buf, size,
@@ -880,7 +883,7 @@ static char *anonymize_tag(void)
880883

881884
static void handle_tag(const char *name, struct tag *tag)
882885
{
883-
unsigned long size;
886+
size_t size;
884887
enum object_type type;
885888
char *buf;
886889
const char *tagger, *tagger_end, *message;

‎builtin/fast-import.c‎

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,8 @@ static void *gfi_unpack_entry(
12391239
unsigned long *sizep)
12401240
{
12411241
enum object_type type;
1242+
size_t size_st = 0;
1243+
void *data;
12421244
struct packed_git *p = all_packs[oe->pack_id];
12431245
if (p == pack_data && p->pack_size < (pack_size + the_hash_algo->rawsz)) {
12441246
/* The object is stored in the packfile we are writing to
@@ -1260,7 +1262,10 @@ static void *gfi_unpack_entry(
12601262
*/
12611263
p->pack_size = pack_size + the_hash_algo->rawsz;
12621264
}
1263-
return unpack_entry(the_repository, p, oe->idx.offset, &type, sizep);
1265+
data = unpack_entry(the_repository, p, oe->idx.offset, &type, &size_st);
1266+
if (sizep)
1267+
*sizep = cast_size_t_to_ulong(size_st);
1268+
return data;
12641269
}
12651270

12661271
static void load_tree(struct tree_entry *root)
@@ -1286,7 +1291,10 @@ static void load_tree(struct tree_entry *root)
12861291
die(_("can't load tree %s"), oid_to_hex(oid));
12871292
} else {
12881293
enum object_type type;
1289-
buf = odb_read_object(the_repository->objects, oid, &type, &size);
1294+
size_t size_st = 0;
1295+
buf = odb_read_object(the_repository->objects, oid, &type,
1296+
&size_st);
1297+
size = cast_size_t_to_ulong(size_st);
12901298
if (!buf || type != OBJ_TREE)
12911299
die(_("can't load tree %s"), oid_to_hex(oid));
12921300
}
@@ -2555,7 +2563,7 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
25552563
die(_("mark :%" PRIuMAX " not a commit"), commit_mark);
25562564
oidcpy(&commit_oid, &commit_oe->idx.oid);
25572565
} else if (!repo_get_oid(the_repository, p, &commit_oid)) {
2558-
unsigned long size;
2566+
size_t size;
25592567
char *buf = odb_read_object_peeled(the_repository->objects,
25602568
&commit_oid, OBJ_COMMIT, &size,
25612569
&commit_oid);
@@ -2622,10 +2630,12 @@ static void parse_from_existing(struct branch *b)
26222630
oidclr(&b->branch_tree.versions[1].oid, the_repository->hash_algo);
26232631
} else {
26242632
unsigned long size;
2633+
size_t size_st = 0;
26252634
char *buf;
26262635

26272636
buf = odb_read_object_peeled(the_repository->objects, &b->oid,
2628-
OBJ_COMMIT, &size, &b->oid);
2637+
OBJ_COMMIT, &size_st, &b->oid);
2638+
size = cast_size_t_to_ulong(size_st);
26292639
parse_from_commit(b, buf, size);
26302640
free(buf);
26312641
}
@@ -2717,7 +2727,7 @@ static struct hash_list *parse_merge(unsigned int *count)
27172727
die(_("mark :%" PRIuMAX " not a commit"), idnum);
27182728
oidcpy(&n->oid, &oe->idx.oid);
27192729
} else if (!repo_get_oid(the_repository, from, &n->oid)) {
2720-
unsigned long size;
2730+
size_t size;
27212731
char *buf = odb_read_object_peeled(the_repository->objects,
27222732
&n->oid, OBJ_COMMIT,
27232733
&size, &n->oid);
@@ -3325,7 +3335,10 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
33253335
char *buf;
33263336

33273337
if (!oe || oe->pack_id == MAX_PACK_ID) {
3328-
buf = odb_read_object(the_repository->objects, oid, &type, &size);
3338+
size_t size_st = 0;
3339+
buf = odb_read_object(the_repository->objects, oid, &type,
3340+
&size_st);
3341+
size = cast_size_t_to_ulong(size_st);
33293342
} else {
33303343
type = oe->type;
33313344
buf = gfi_unpack_entry(oe, &size);
@@ -3433,8 +3446,10 @@ static struct object_entry *dereference(struct object_entry *oe,
34333446
buf = gfi_unpack_entry(oe, &size);
34343447
} else {
34353448
enum object_type unused;
3449+
size_t size_st = 0;
34363450
buf = odb_read_object(the_repository->objects, oid,
3437-
&unused, &size);
3451+
&unused, &size_st);
3452+
size = cast_size_t_to_ulong(size_st);
34383453
}
34393454
if (!buf)
34403455
die(_("can't load object %s"), oid_to_hex(oid));

‎builtin/fsck.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ static int fsck_loose(const struct object_id *oid, const char *path,
724724
struct for_each_loose_cb *data = cb_data;
725725
struct object *obj;
726726
enum object_type type = OBJ_NONE;
727-
unsigned long size;
727+
size_t size;
728728
void *contents = NULL;
729729
int eaten;
730730
struct object_info oi = OBJECT_INFO_INIT;

0 commit comments

Comments
 (0)