Skip to content

Commit bc726bd

Browse files
avargitster
authored andcommitted
cocci: apply the "object-store.h" part of "the_repository.pending"
Apply the part of "the_repository.pending.cocci" pertaining to "object-store.h". Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0853903 commit bc726bd

Some content is hidden

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

60 files changed

+184
-142
lines changed

apply.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3201,7 +3201,8 @@ static int apply_binary(struct apply_state *state,
32013201
unsigned long size;
32023202
char *result;
32033203

3204-
result = read_object_file(&oid, &type, &size);
3204+
result = repo_read_object_file(the_repository, &oid, &type,
3205+
&size);
32053206
if (!result)
32063207
return error(_("the necessary postimage %s for "
32073208
"'%s' cannot be read"),
@@ -3264,7 +3265,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns
32643265
unsigned long sz;
32653266
char *result;
32663267

3267-
result = read_object_file(oid, &type, &sz);
3268+
result = repo_read_object_file(the_repository, oid, &type,
3269+
&sz);
32683270
if (!result)
32693271
return -1;
32703272
/* XXX read_sha1_file NUL-terminates */
@@ -3492,7 +3494,8 @@ static int resolve_to(struct image *image, const struct object_id *result_id)
34923494

34933495
clear_image(image);
34943496

3495-
image->buf = read_object_file(result_id, &type, &size);
3497+
image->buf = repo_read_object_file(the_repository, result_id, &type,
3498+
&size);
34963499
if (!image->buf || type != OBJ_BLOB)
34973500
die("unable to read blob object %s", oid_to_hex(result_id));
34983501
image->len = size;

archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static void *object_file_to_archive(const struct archiver_args *args,
8484
(args->tree ? &args->tree->object.oid : NULL), oid);
8585

8686
path += args->baselen;
87-
buffer = read_object_file(oid, type, sizep);
87+
buffer = repo_read_object_file(the_repository, oid, type, sizep);
8888
if (buffer && S_ISREG(mode)) {
8989
struct strbuf buf = STRBUF_INIT;
9090
size_t size = 0;

bisect.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,9 @@ static void show_list(const char *debug, int counted, int nr,
148148
unsigned commit_flags = commit->object.flags;
149149
enum object_type type;
150150
unsigned long size;
151-
char *buf = read_object_file(&commit->object.oid, &type,
152-
&size);
151+
char *buf = repo_read_object_file(the_repository,
152+
&commit->object.oid, &type,
153+
&size);
153154
const char *subject_start;
154155
int subject_len;
155156

blame.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,9 @@ static void fill_origin_blob(struct diff_options *opt,
10281028
&o->blob_oid, 1, &file->ptr, &file_size))
10291029
;
10301030
else
1031-
file->ptr = read_object_file(&o->blob_oid, &type,
1032-
&file_size);
1031+
file->ptr = repo_read_object_file(the_repository,
1032+
&o->blob_oid, &type,
1033+
&file_size);
10331034
file->size = file_size;
10341035

10351036
if (!file->ptr)
@@ -2838,8 +2839,10 @@ void setup_scoreboard(struct blame_scoreboard *sb,
28382839
&sb->final_buf_size))
28392840
;
28402841
else
2841-
sb->final_buf = read_object_file(&o->blob_oid, &type,
2842-
&sb->final_buf_size);
2842+
sb->final_buf = repo_read_object_file(the_repository,
2843+
&o->blob_oid,
2844+
&type,
2845+
&sb->final_buf_size);
28432846

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

builtin/cat-file.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static int filter_object(const char *path, unsigned mode,
6060
{
6161
enum object_type type;
6262

63-
*buf = read_object_file(oid, &type, size);
63+
*buf = repo_read_object_file(the_repository, oid, &type, size);
6464
if (!*buf)
6565
return error(_("cannot read object %s '%s'"),
6666
oid_to_hex(oid), path);
@@ -152,7 +152,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
152152
goto cleanup;
153153

154154
case 'e':
155-
return !has_object_file(&oid);
155+
return !repo_has_object_file(the_repository, &oid);
156156

157157
case 'w':
158158

@@ -187,7 +187,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
187187
ret = stream_blob(&oid);
188188
goto cleanup;
189189
}
190-
buf = read_object_file(&oid, &type, &size);
190+
buf = repo_read_object_file(the_repository, &oid, &type,
191+
&size);
191192
if (!buf)
192193
die("Cannot read object %s", obj_name);
193194

@@ -207,8 +208,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
207208
if (exp_type_id == OBJ_BLOB) {
208209
struct object_id blob_oid;
209210
if (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) {
210-
char *buffer = read_object_file(&oid, &type,
211-
&size);
211+
char *buffer = repo_read_object_file(the_repository,
212+
&oid,
213+
&type,
214+
&size);
212215
const char *target;
213216
if (!skip_prefix(buffer, "object ", &target) ||
214217
get_oid_hex(target, &blob_oid))
@@ -383,9 +386,10 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
383386
if (!textconv_object(the_repository,
384387
data->rest, 0100644, oid,
385388
1, &contents, &size))
386-
contents = read_object_file(oid,
387-
&type,
388-
&size);
389+
contents = repo_read_object_file(the_repository,
390+
oid,
391+
&type,
392+
&size);
389393
if (!contents)
390394
die("could not convert '%s' %s",
391395
oid_to_hex(oid), data->rest);
@@ -402,7 +406,8 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
402406
unsigned long size;
403407
void *contents;
404408

405-
contents = read_object_file(oid, &type, &size);
409+
contents = repo_read_object_file(the_repository, oid, &type,
410+
&size);
406411

407412
if (use_mailmap) {
408413
size_t s = size;

builtin/clone.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,9 @@ static void write_followtags(const struct ref *refs, const char *msg)
547547
continue;
548548
if (ends_with(ref->name, "^{}"))
549549
continue;
550-
if (!has_object_file_with_flags(&ref->old_oid,
551-
OBJECT_INFO_QUICK |
552-
OBJECT_INFO_SKIP_FETCH_OBJECT))
550+
if (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,
551+
OBJECT_INFO_QUICK |
552+
OBJECT_INFO_SKIP_FETCH_OBJECT))
553553
continue;
554554
update_ref(msg, ref->name, &ref->old_oid, NULL, 0,
555555
UPDATE_REFS_DIE_ON_ERR);

builtin/difftool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ static char *get_symlink(const struct object_id *oid, const char *path)
295295
} else {
296296
enum object_type type;
297297
unsigned long size;
298-
data = read_object_file(oid, &type, &size);
298+
data = repo_read_object_file(the_repository, oid, &type,
299+
&size);
299300
if (!data)
300301
die(_("could not read object %s for symlink %s"),
301302
oid_to_hex(oid), path);

builtin/fast-export.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static void export_blob(const struct object_id *oid)
296296
object = (struct object *)lookup_blob(the_repository, oid);
297297
eaten = 0;
298298
} else {
299-
buf = read_object_file(oid, &type, &size);
299+
buf = repo_read_object_file(the_repository, oid, &type, &size);
300300
if (!buf)
301301
die("could not read blob %s", oid_to_hex(oid));
302302
if (check_object_signature(the_repository, oid, buf, size,
@@ -766,7 +766,8 @@ static void handle_tag(const char *name, struct tag *tag)
766766
return;
767767
}
768768

769-
buf = read_object_file(&tag->object.oid, &type, &size);
769+
buf = repo_read_object_file(the_repository, &tag->object.oid, &type,
770+
&size);
770771
if (!buf)
771772
die("could not read tag %s", oid_to_hex(&tag->object.oid));
772773
message = memmem(buf, size, "\n\n", 2);

builtin/fast-import.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ static void load_tree(struct tree_entry *root)
12651265
die("Can't load tree %s", oid_to_hex(oid));
12661266
} else {
12671267
enum object_type type;
1268-
buf = read_object_file(oid, &type, &size);
1268+
buf = repo_read_object_file(the_repository, oid, &type, &size);
12691269
if (!buf || type != OBJ_TREE)
12701270
die("Can't load tree %s", oid_to_hex(oid));
12711271
}
@@ -2936,7 +2936,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
29362936
char *buf;
29372937

29382938
if (!oe || oe->pack_id == MAX_PACK_ID) {
2939-
buf = read_object_file(oid, &type, &size);
2939+
buf = repo_read_object_file(the_repository, oid, &type, &size);
29402940
} else {
29412941
type = oe->type;
29422942
buf = gfi_unpack_entry(oe, &size);
@@ -3044,7 +3044,8 @@ static struct object_entry *dereference(struct object_entry *oe,
30443044
buf = gfi_unpack_entry(oe, &size);
30453045
} else {
30463046
enum object_type unused;
3047-
buf = read_object_file(oid, &unused, &size);
3047+
buf = repo_read_object_file(the_repository, oid, &unused,
3048+
&size);
30483049
}
30493050
if (!buf)
30503051
die("Can't load object %s", oid_to_hex(oid));

builtin/fetch.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,9 @@ static void find_non_local_tags(const struct ref *refs,
407407
*/
408408
if (ends_with(ref->name, "^{}")) {
409409
if (item &&
410-
!has_object_file_with_flags(&ref->old_oid, quick_flags) &&
410+
!repo_has_object_file_with_flags(the_repository, &ref->old_oid, quick_flags) &&
411411
!oidset_contains(&fetch_oids, &ref->old_oid) &&
412-
!has_object_file_with_flags(&item->oid, quick_flags) &&
412+
!repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&
413413
!oidset_contains(&fetch_oids, &item->oid))
414414
clear_item(item);
415415
item = NULL;
@@ -423,7 +423,7 @@ static void find_non_local_tags(const struct ref *refs,
423423
* fetch.
424424
*/
425425
if (item &&
426-
!has_object_file_with_flags(&item->oid, quick_flags) &&
426+
!repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&
427427
!oidset_contains(&fetch_oids, &item->oid))
428428
clear_item(item);
429429

@@ -444,7 +444,7 @@ static void find_non_local_tags(const struct ref *refs,
444444
* checked to see if it needs fetching.
445445
*/
446446
if (item &&
447-
!has_object_file_with_flags(&item->oid, quick_flags) &&
447+
!repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&
448448
!oidset_contains(&fetch_oids, &item->oid))
449449
clear_item(item);
450450

@@ -1320,8 +1320,8 @@ static int check_exist_and_connected(struct ref *ref_map)
13201320
* we need all direct targets to exist.
13211321
*/
13221322
for (r = rm; r; r = r->next) {
1323-
if (!has_object_file_with_flags(&r->old_oid,
1324-
OBJECT_INFO_SKIP_FETCH_OBJECT))
1323+
if (!repo_has_object_file_with_flags(the_repository, &r->old_oid,
1324+
OBJECT_INFO_SKIP_FETCH_OBJECT))
13251325
return -1;
13261326
}
13271327

0 commit comments

Comments
 (0)