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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Mar 28, 2023 at 15:58 UTC
bc726bd075929aab6b3e09d4dd5c2b0726fd5350
60 files changed
+184
-142
apply.c
+6
-3
@@ -3201,7 +3201,8 @@ static int apply_binary(struct apply_state *state,
3201
unsigned long size;
3202
char *result;
3203
3204
- result = read_object_file(&oid, &type, &size);
3204
+ result = repo_read_object_file(the_repository, &oid, &type,
3205
+ &size);
3206
if (!result)
3207
return error(_("the necessary postimage %s for "
3208
"'%s' cannot be read"),
@@ -3264,7 +3265,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns
3265
unsigned long sz;
3266
char *result;
3267
3267
- result = read_object_file(oid, &type, &sz);
3268
+ result = repo_read_object_file(the_repository, oid, &type,
3269
+ &sz);
3270
if (!result)
3271
return -1;
3272
/* XXX read_sha1_file NUL-terminates */
@@ -3492,7 +3494,8 @@ static int resolve_to(struct image *image, const struct object_id *result_id)
3494
3495
clear_image(image);
3496
3495
- image->buf = read_object_file(result_id, &type, &size);
3497
+ image->buf = repo_read_object_file(the_repository, result_id, &type,
3498
+ &size);
3499
if (!image->buf || type != OBJ_BLOB)
3500
die("unable to read blob object %s", oid_to_hex(result_id));
3501
image->len = size;
archive.c
+1
-1
@@ -84,7 +84,7 @@ static void *object_file_to_archive(const struct archiver_args *args,
84
(args->tree ? &args->tree->object.oid : NULL), oid);
85
86
path += args->baselen;
87
- buffer = read_object_file(oid, type, sizep);
87
+ buffer = repo_read_object_file(the_repository, oid, type, sizep);
88
if (buffer && S_ISREG(mode)) {
89
struct strbuf buf = STRBUF_INIT;
90
size_t size = 0;
bisect.c
+3
-2
@@ -148,8 +148,9 @@ static void show_list(const char *debug, int counted, int nr,
148
unsigned commit_flags = commit->object.flags;
149
enum object_type type;
150
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);
154
const char *subject_start;
155
int subject_len;
156
blame.c
+7
-4
@@ -1028,8 +1028,9 @@ static void fill_origin_blob(struct diff_options *opt,
1028
&o->blob_oid, 1, &file->ptr, &file_size))
1029
;
1030
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);
1034
file->size = file_size;
1035
1036
if (!file->ptr)
@@ -2838,8 +2839,10 @@ void setup_scoreboard(struct blame_scoreboard *sb,
2839
&sb->final_buf_size))
2840
;
2841
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);
2846
2847
if (!sb->final_buf)
2848
die(_("cannot read blob %s for path %s"),
builtin/cat-file.c
+14
-9
@@ -60,7 +60,7 @@ static int filter_object(const char *path, unsigned mode,
60
{
61
enum object_type type;
62
63
- *buf = read_object_file(oid, &type, size);
63
+ *buf = repo_read_object_file(the_repository, oid, &type, size);
64
if (!*buf)
65
return error(_("cannot read object %s '%s'"),
66
oid_to_hex(oid), path);
@@ -152,7 +152,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
152
goto cleanup;
153
154
case 'e':
155
- return !has_object_file(&oid);
155
+ return !repo_has_object_file(the_repository, &oid);
156
157
case 'w':
158
@@ -187,7 +187,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
187
ret = stream_blob(&oid);
188
goto cleanup;
189
}
190
- buf = read_object_file(&oid, &type, &size);
190
+ buf = repo_read_object_file(the_repository, &oid, &type,
191
+ &size);
192
if (!buf)
193
die("Cannot read object %s", obj_name);
194
@@ -207,8 +208,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
208
if (exp_type_id == OBJ_BLOB) {
209
struct object_id blob_oid;
210
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);
215
const char *target;
216
if (!skip_prefix(buffer, "object ", &target) ||
217
get_oid_hex(target, &blob_oid))
@@ -383,9 +386,10 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
386
if (!textconv_object(the_repository,
387
data->rest, 0100644, oid,
388
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);
393
if (!contents)
394
die("could not convert '%s' %s",
395
oid_to_hex(oid), data->rest);
@@ -402,7 +406,8 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
406
unsigned long size;
407
void *contents;
408
405
- contents = read_object_file(oid, &type, &size);
409
+ contents = repo_read_object_file(the_repository, oid, &type,
410
+ &size);
411
412
if (use_mailmap) {
413
size_t s = size;
builtin/clone.c
+3
-3
@@ -547,9 +547,9 @@ static void write_followtags(const struct ref *refs, const char *msg)
547
continue;
548
if (ends_with(ref->name, "^{}"))
549
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))
553
continue;
554
update_ref(msg, ref->name, &ref->old_oid, NULL, 0,
555
UPDATE_REFS_DIE_ON_ERR);
builtin/difftool.c
+2
-1
@@ -295,7 +295,8 @@ static char *get_symlink(const struct object_id *oid, const char *path)
295
} else {
296
enum object_type type;
297
unsigned long size;
298
- data = read_object_file(oid, &type, &size);
298
+ data = repo_read_object_file(the_repository, oid, &type,
299
+ &size);
300
if (!data)
301
die(_("could not read object %s for symlink %s"),
302
oid_to_hex(oid), path);
builtin/fast-export.c
+3
-2
@@ -296,7 +296,7 @@ static void export_blob(const struct object_id *oid)
296
object = (struct object *)lookup_blob(the_repository, oid);
297
eaten = 0;
298
} else {
299
- buf = read_object_file(oid, &type, &size);
299
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
300
if (!buf)
301
die("could not read blob %s", oid_to_hex(oid));
302
if (check_object_signature(the_repository, oid, buf, size,
@@ -766,7 +766,8 @@ static void handle_tag(const char *name, struct tag *tag)
766
return;
767
}
768
769
- buf = read_object_file(&tag->object.oid, &type, &size);
769
+ buf = repo_read_object_file(the_repository, &tag->object.oid, &type,
770
+ &size);
771
if (!buf)
772
die("could not read tag %s", oid_to_hex(&tag->object.oid));
773
message = memmem(buf, size, "\n\n", 2);
builtin/fast-import.c
+4
-3
@@ -1265,7 +1265,7 @@ static void load_tree(struct tree_entry *root)
1265
die("Can't load tree %s", oid_to_hex(oid));
1266
} else {
1267
enum object_type type;
1268
- buf = read_object_file(oid, &type, &size);
1268
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
1269
if (!buf || type != OBJ_TREE)
1270
die("Can't load tree %s", oid_to_hex(oid));
1271
}
@@ -2936,7 +2936,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
2936
char *buf;
2937
2938
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);
2940
} else {
2941
type = oe->type;
2942
buf = gfi_unpack_entry(oe, &size);
@@ -3044,7 +3044,8 @@ static struct object_entry *dereference(struct object_entry *oe,
3044
buf = gfi_unpack_entry(oe, &size);
3045
} else {
3046
enum object_type unused;
3047
- buf = read_object_file(oid, &unused, &size);
3047
+ buf = repo_read_object_file(the_repository, oid, &unused,
3048
+ &size);
3049
}
3050
if (!buf)
3051
die("Can't load object %s", oid_to_hex(oid));
builtin/fetch.c
+6
-6
@@ -407,9 +407,9 @@ static void find_non_local_tags(const struct ref *refs,
407
*/
408
if (ends_with(ref->name, "^{}")) {
409
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) &&
411
!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) &&
413
!oidset_contains(&fetch_oids, &item->oid))
414
clear_item(item);
415
item = NULL;
@@ -423,7 +423,7 @@ static void find_non_local_tags(const struct ref *refs,
423
* fetch.
424
*/
425
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) &&
427
!oidset_contains(&fetch_oids, &item->oid))
428
clear_item(item);
429
@@ -444,7 +444,7 @@ static void find_non_local_tags(const struct ref *refs,
444
* checked to see if it needs fetching.
445
*/
446
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) &&
448
!oidset_contains(&fetch_oids, &item->oid))
449
clear_item(item);
450
@@ -1320,8 +1320,8 @@ static int check_exist_and_connected(struct ref *ref_map)
1320
* we need all direct targets to exist.
1321
*/
1322
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))
1325
return -1;
1326
}
1327
builtin/grep.c
+4
-2
@@ -560,7 +560,8 @@ static int grep_cache(struct grep_opt *opt,
560
void *data;
561
unsigned long size;
562
563
- data = read_object_file(&ce->oid, &type, &size);
563
+ data = repo_read_object_file(the_repository, &ce->oid,
564
+ &type, &size);
565
init_tree_desc(&tree, data, size);
566
567
hit |= grep_tree(opt, pathspec, &tree, &name, 0, 0);
@@ -650,7 +651,8 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
651
void *data;
652
unsigned long size;
653
653
- data = read_object_file(&entry.oid, &type, &size);
654
+ data = repo_read_object_file(the_repository,
655
+ &entry.oid, &type, &size);
656
if (!data)
657
die(_("unable to read tree (%s)"),
658
oid_to_hex(&entry.oid));
builtin/index-pack.c
+6
-3
@@ -801,7 +801,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
801
if (startup_info->have_repository) {
802
read_lock();
803
collision_test_needed =
804
- has_object_file_with_flags(oid, OBJECT_INFO_QUICK);
804
+ repo_has_object_file_with_flags(the_repository, oid,
805
+ OBJECT_INFO_QUICK);
806
read_unlock();
807
}
808
@@ -821,7 +822,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
822
die(_("cannot read existing object info %s"), oid_to_hex(oid));
823
if (has_type != type || has_size != size)
824
die(_("SHA1 COLLISION FOUND WITH %s !"), oid_to_hex(oid));
824
- has_data = read_object_file(oid, &has_type, &has_size);
825
+ has_data = repo_read_object_file(the_repository, oid,
826
+ &has_type, &has_size);
827
read_unlock();
828
if (!data)
829
data = new_data = get_data_from_pack(obj_entry);
@@ -1414,7 +1416,8 @@ static void fix_unresolved_deltas(struct hashfile *f)
1416
1417
if (objects[d->obj_no].real_type != OBJ_REF_DELTA)
1418
continue;
1417
- data = read_object_file(&d->oid, &type, &size);
1419
+ data = repo_read_object_file(the_repository, &d->oid, &type,
1420
+ &size);
1421
if (!data)
1422
continue;
1423
builtin/log.c
+1
-1
@@ -675,7 +675,7 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)
675
{
676
unsigned long size;
677
enum object_type type;
678
- char *buf = read_object_file(oid, &type, &size);
678
+ char *buf = repo_read_object_file(the_repository, oid, &type, &size);
679
int offset = 0;
680
681
if (!buf)
builtin/merge-tree.c
+6
-3
@@ -69,7 +69,9 @@ static void *result(struct merge_list *entry, unsigned long *size)
69
const char *path = entry->path;
70
71
if (!entry->stage)
72
- return read_object_file(&entry->blob->object.oid, &type, size);
72
+ return repo_read_object_file(the_repository,
73
+ &entry->blob->object.oid, &type,
74
+ size);
75
base = NULL;
76
if (entry->stage == 1) {
77
base = entry->blob;
@@ -92,8 +94,9 @@ static void *origin(struct merge_list *entry, unsigned long *size)
94
enum object_type type;
95
while (entry) {
96
if (entry->stage == 2)
95
- return read_object_file(&entry->blob->object.oid,
96
- &type, size);
97
+ return repo_read_object_file(the_repository,
98
+ &entry->blob->object.oid,
99
+ &type, size);
100
entry = entry->link;
101
}
102
return NULL;
builtin/mktag.c
+2
-1
@@ -51,7 +51,8 @@ static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type)
51
void *buffer;
52
const struct object_id *repl;
53
54
- buffer = read_object_file(tagged_oid, &type, &size);
54
+ buffer = repo_read_object_file(the_repository, tagged_oid, &type,
55
+ &size);
56
if (!buffer)
57
die(_("could not read tagged object '%s'"),
58
oid_to_hex(tagged_oid));
builtin/notes.c
+4
-3
@@ -124,7 +124,7 @@ static void copy_obj_to_fd(int fd, const struct object_id *oid)
124
{
125
unsigned long size;
126
enum object_type type;
127
- char *buf = read_object_file(oid, &type, &size);
127
+ char *buf = repo_read_object_file(the_repository, oid, &type, &size);
128
if (buf) {
129
if (size)
130
write_or_die(fd, buf, size);
@@ -259,7 +259,7 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
259
260
if (repo_get_oid(the_repository, arg, &object))
261
die(_("failed to resolve '%s' as a valid ref."), arg);
262
- if (!(buf = read_object_file(&object, &type, &len)))
262
+ if (!(buf = repo_read_object_file(the_repository, &object, &type, &len)))
263
die(_("failed to read object '%s'."), arg);
264
if (type != OBJ_BLOB) {
265
free(buf);
@@ -616,7 +616,8 @@ static int append_edit(int argc, const char **argv, const char *prefix)
616
/* Append buf to previous note contents */
617
unsigned long size;
618
enum object_type type;
619
- char *prev_buf = read_object_file(note, &type, &size);
619
+ char *prev_buf = repo_read_object_file(the_repository, note,
620
+ &type, &size);
621
622
strbuf_grow(&d.buf, size + 1);
623
if (d.buf.len && prev_buf && size)
builtin/pack-objects.c
+15
-7
@@ -288,11 +288,13 @@ static void *get_delta(struct object_entry *entry)
288
void *buf, *base_buf, *delta_buf;
289
enum object_type type;
290
291
- buf = read_object_file(&entry->idx.oid, &type, &size);
291
+ buf = repo_read_object_file(the_repository, &entry->idx.oid, &type,
292
+ &size);
293
if (!buf)
294
die(_("unable to read %s"), oid_to_hex(&entry->idx.oid));
294
- base_buf = read_object_file(&DELTA(entry)->idx.oid, &type,
295
- &base_size);
295
+ base_buf = repo_read_object_file(the_repository,
296
+ &DELTA(entry)->idx.oid, &type,
297
+ &base_size);
298
if (!base_buf)
299
die("unable to read %s",
300
oid_to_hex(&DELTA(entry)->idx.oid));
@@ -454,7 +456,9 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent
456
&size, NULL)) != NULL)
457
buf = NULL;
458
else {
457
- buf = read_object_file(&entry->idx.oid, &type, &size);
459
+ buf = repo_read_object_file(the_repository,
460
+ &entry->idx.oid, &type,
461
+ &size);
462
if (!buf)
463
die(_("unable to read %s"),
464
oid_to_hex(&entry->idx.oid));
@@ -1665,7 +1669,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)
1669
/* Did not find one. Either we got a bogus request or
1670
* we need to read and perhaps cache.
1671
*/
1668
- data = read_object_file(oid, &type, &size);
1672
+ data = repo_read_object_file(the_repository, oid, &type, &size);
1673
if (!data)
1674
return NULL;
1675
if (type != OBJ_TREE) {
@@ -2525,7 +2529,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
2529
/* Load data if not already done */
2530
if (!trg->data) {
2531
packing_data_lock(&to_pack);
2528
- trg->data = read_object_file(&trg_entry->idx.oid, &type, &sz);
2532
+ trg->data = repo_read_object_file(the_repository,
2533
+ &trg_entry->idx.oid, &type,
2534
+ &sz);
2535
packing_data_unlock(&to_pack);
2536
if (!trg->data)
2537
die(_("object %s cannot be read"),
@@ -2538,7 +2544,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
2544
}
2545
if (!src->data) {
2546
packing_data_lock(&to_pack);
2541
- src->data = read_object_file(&src_entry->idx.oid, &type, &sz);
2547
+ src->data = repo_read_object_file(the_repository,
2548
+ &src_entry->idx.oid, &type,
2549
+ &sz);
2550
packing_data_unlock(&to_pack);
2551
if (!src->data) {
2552
if (src_entry->preferred_base) {
builtin/receive-pack.c
+1
-1
@@ -1494,7 +1494,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
1494
}
1495
}
1496
1497
- if (!is_null_oid(new_oid) && !has_object_file(new_oid)) {
1497
+ if (!is_null_oid(new_oid) && !repo_has_object_file(the_repository, new_oid)) {
1498
error("unpack should have generated %s, "
1499
"but I can't find it!", oid_to_hex(new_oid));
1500
ret = "bad pack";
builtin/remote.c
+1
-1
@@ -443,7 +443,7 @@ static int get_push_ref_states(const struct ref *remote_refs,
443
info->status = PUSH_STATUS_UPTODATE;
444
else if (is_null_oid(&ref->old_oid))
445
info->status = PUSH_STATUS_CREATE;
446
- else if (has_object_file(&ref->old_oid) &&
446
+ else if (repo_has_object_file(the_repository, &ref->old_oid) &&
447
ref_newer(&ref->new_oid, &ref->old_oid))
448
info->status = PUSH_STATUS_FASTFORWARD;
449
else
builtin/show-ref.c
+1
-1
@@ -26,7 +26,7 @@ static void show_one(const char *refname, const struct object_id *oid)
26
const char *hex;
27
struct object_id peeled;
28
29
- if (!has_object_file(oid))
29
+ if (!repo_has_object_file(the_repository, oid))
30
die("git show-ref: bad ref %s (%s)", refname,
31
oid_to_hex(oid));
32
builtin/tag.c
+2
-2
@@ -215,7 +215,7 @@ static void write_tag_body(int fd, const struct object_id *oid)
215
struct strbuf payload = STRBUF_INIT;
216
struct strbuf signature = STRBUF_INIT;
217
218
- orig = buf = read_object_file(oid, &type, &size);
218
+ orig = buf = repo_read_object_file(the_repository, oid, &type, &size);
219
if (!buf)
220
return;
221
if (parse_signature(buf, size, &payload, &signature)) {
@@ -366,7 +366,7 @@ static void create_reflog_msg(const struct object_id *oid, struct strbuf *sb)
366
strbuf_addstr(sb, "object of unknown type");
367
break;
368
case OBJ_COMMIT:
369
- if ((buf = read_object_file(oid, &type, &size))) {
369
+ if ((buf = repo_read_object_file(the_repository, oid, &type, &size))) {
370
subject_len = find_commit_subject(buf, &subject_start);
371
strbuf_insert(sb, sb->len, subject_start, subject_len);
372
} else {
builtin/unpack-file.c
+1
-1
@@ -10,7 +10,7 @@ static char *create_temp_file(struct object_id *oid)
10
unsigned long size;
11
int fd;
12
13
- buf = read_object_file(oid, &type, &size);
13
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
14
if (!buf || type != OBJ_BLOB)
15
die("unable to read blob object %s", oid_to_hex(oid));
16
builtin/unpack-objects.c
+3
-2
@@ -442,7 +442,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
442
delta_data = get_data(delta_size);
443
if (!delta_data)
444
return;
445
- if (has_object_file(&base_oid))
445
+ if (repo_has_object_file(the_repository, &base_oid))
446
; /* Ok we have this one */
447
else if (resolve_against_held(nr, &base_oid,
448
delta_data, delta_size))
@@ -508,7 +508,8 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
508
if (resolve_against_held(nr, &base_oid, delta_data, delta_size))
509
return;
510
511
- base = read_object_file(&base_oid, &type, &base_size);
511
+ base = repo_read_object_file(the_repository, &base_oid, &type,
512
+ &base_size);
513
if (!base) {
514
error("failed to read delta-pack base object %s",
515
oid_to_hex(&base_oid));
bulk-checkin.c
+1
-1
@@ -124,7 +124,7 @@ static int already_written(struct bulk_checkin_packfile *state, struct object_id
124
int i;
125
126
/* The object may already exist in the repository */
127
- if (has_object_file(oid))
127
+ if (repo_has_object_file(the_repository, oid))
128
return 1;
129
130
/* Might want to keep the list sorted */
bundle.c
+1
-1
@@ -293,7 +293,7 @@ static int is_tag_in_date_range(struct object *tag, struct rev_info *revs)
293
if (revs->max_age == -1 && revs->min_age == -1)
294
goto out;
295
296
- buf = read_object_file(&tag->oid, &type, &size);
296
+ buf = repo_read_object_file(the_repository, &tag->oid, &type, &size);
297
if (!buf)
298
goto out;
299
line = memmem(buf, size, "\ntagger ", 8);
cache-tree.c
+4
-4
@@ -229,7 +229,7 @@ int cache_tree_fully_valid(struct cache_tree *it)
229
int i;
230
if (!it)
231
return 0;
232
- if (it->entry_count < 0 || !has_object_file(&it->oid))
232
+ if (it->entry_count < 0 || !repo_has_object_file(the_repository, &it->oid))
233
return 0;
234
for (i = 0; i < it->subtree_nr; i++) {
235
if (!cache_tree_fully_valid(it->down[i]->cache_tree))
@@ -280,7 +280,7 @@ static int update_one(struct cache_tree *it,
280
}
281
}
282
283
- if (0 <= it->entry_count && has_object_file(&it->oid))
283
+ if (0 <= it->entry_count && repo_has_object_file(the_repository, &it->oid))
284
return it->entry_count;
285
286
/*
@@ -386,7 +386,7 @@ static int update_one(struct cache_tree *it,
386
ce_missing_ok = mode == S_IFGITLINK || missing_ok ||
387
!must_check_existence(ce);
388
if (is_null_oid(oid) ||
389
- (!ce_missing_ok && !has_object_file(oid))) {
389
+ (!ce_missing_ok && !repo_has_object_file(the_repository, oid))) {
390
strbuf_release(&buffer);
391
if (expected_missing)
392
return -1;
@@ -434,7 +434,7 @@ static int update_one(struct cache_tree *it,
434
struct object_id oid;
435
hash_object_file(the_hash_algo, buffer.buf, buffer.len,
436
OBJ_TREE, &oid);
437
- if (has_object_file_with_flags(&oid, OBJECT_INFO_SKIP_FETCH_OBJECT))
437
+ if (repo_has_object_file_with_flags(the_repository, &oid, OBJECT_INFO_SKIP_FETCH_OBJECT))
438
oidcpy(&it->oid, &oid);
439
else
440
to_invalidate = 1;
combine-diff.c
+1
-1
@@ -332,7 +332,7 @@ static char *grab_blob(struct repository *r,
332
*size = fill_textconv(r, textconv, df, &blob);
333
free_filespec(df);
334
} else {
335
- blob = read_object_file(oid, &type, size);
335
+ blob = repo_read_object_file(the_repository, oid, &type, size);
336
if (type != OBJ_BLOB)
337
die("object '%s' is not a blob!", oid_to_hex(oid));
338
}
commit.c
+2
-1
@@ -1212,7 +1212,8 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
1212
desc = merge_remote_util(parent);
1213
if (!desc || !desc->obj)
1214
return;
1215
- buf = read_object_file(&desc->obj->oid, &type, &size);
1215
+ buf = repo_read_object_file(the_repository, &desc->obj->oid, &type,
1216
+ &size);
1217
if (!buf || type != OBJ_TAG)
1218
goto free_return;
1219
if (!parse_signature(buf, size, &payload, &signature))
contrib/coccinelle/the_repository.cocci
+10
@@ -77,6 +77,16 @@
77
|
78
- diff_setup
79
+ repo_diff_setup
80
+// object-store.h
81
+|
82
+- read_object_file
83
++ repo_read_object_file
84
+|
85
+- has_object_file
86
++ repo_has_object_file
87
+|
88
+- has_object_file_with_flags
89
++ repo_has_object_file_with_flags
90
)
91
(
92
+ the_repository,
contrib/coccinelle/the_repository.pending.cocci
-10
@@ -5,17 +5,7 @@
5
@@
6
@@
7
(
8
-// object-store.h
9
-- read_object_file
10
-+ repo_read_object_file
11
-|
12
-- has_object_file
13
-+ repo_has_object_file
14
-|
15
-- has_object_file_with_flags
16
-+ repo_has_object_file_with_flags
8
// pretty.h
18
-|
9
- format_commit_message
10
+ repo_format_commit_message
11
// packfile.h
dir.c
+1
-1
@@ -267,7 +267,7 @@ static int do_read_blob(const struct object_id *oid, struct oid_stat *oid_stat,
267
*size_out = 0;
268
*data_out = NULL;
269
270
- data = read_object_file(oid, &type, &sz);
270
+ data = repo_read_object_file(the_repository, oid, &type, &sz);
271
if (!data || type != OBJ_BLOB) {
272
free(data);
273
return -1;
entry.c
+2
-1
@@ -86,7 +86,8 @@ void *read_blob_entry(const struct cache_entry *ce, size_t *size)
86
{
87
enum object_type type;
88
unsigned long ul;
89
- void *blob_data = read_object_file(&ce->oid, &type, &ul);
89
+ void *blob_data = repo_read_object_file(the_repository, &ce->oid,
90
+ &type, &ul);
91
92
*size = ul;
93
if (blob_data) {
fetch-pack.c
+4
-4
@@ -762,9 +762,9 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
762
if (!commit) {
763
struct object *o;
764
765
- if (!has_object_file_with_flags(&ref->old_oid,
766
- OBJECT_INFO_QUICK |
767
- OBJECT_INFO_SKIP_FETCH_OBJECT))
765
+ if (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,
766
+ OBJECT_INFO_QUICK |
767
+ OBJECT_INFO_SKIP_FETCH_OBJECT))
768
continue;
769
o = parse_object(the_repository, &ref->old_oid);
770
if (!o || o->type != OBJ_COMMIT)
@@ -1963,7 +1963,7 @@ static void update_shallow(struct fetch_pack_args *args,
1963
struct oid_array extra = OID_ARRAY_INIT;
1964
struct object_id *oid = si->shallow->oid;
1965
for (i = 0; i < si->shallow->nr; i++)
1966
- if (has_object_file(&oid[i]))
1966
+ if (repo_has_object_file(the_repository, &oid[i]))
1967
oid_array_append(&extra, &oid[i]);
1968
if (extra.nr) {
1969
setup_alternate_shallow(&shallow_lock,
fmt-merge-msg.c
+2
-1
@@ -520,7 +520,8 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
520
struct object_id *oid = origins.items[i].util;
521
enum object_type type;
522
unsigned long size;
523
- char *buf = read_object_file(oid, &type, &size);
523
+ char *buf = repo_read_object_file(the_repository, oid, &type,
524
+ &size);
525
char *origbuf = buf;
526
unsigned long len = size;
527
struct signature_check sigc = { NULL };
fsck.c
+1
-1
@@ -1332,7 +1332,7 @@ static int fsck_blobs(struct oidset *blobs_found, struct oidset *blobs_done,
1332
if (oidset_contains(blobs_done, oid))
1333
continue;
1334
1335
- buf = read_object_file(oid, &type, &size);
1335
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
1336
if (!buf) {
1337
if (is_promisor_object(oid))
1338
continue;
http-push.c
+6
-5
@@ -362,7 +362,8 @@ static void start_put(struct transfer_request *request)
362
ssize_t size;
363
git_zstream stream;
364
365
- unpacked = read_object_file(&request->obj->oid, &type, &len);
365
+ unpacked = repo_read_object_file(the_repository, &request->obj->oid,
366
+ &type, &len);
367
hdrlen = format_object_header(hdr, sizeof(hdr), type, len);
368
369
/* Set it up */
@@ -1427,7 +1428,7 @@ static void one_remote_ref(const char *refname)
1428
* Fetch a copy of the object if it doesn't exist locally - it
1429
* may be required for updating server info later.
1430
*/
1430
- if (repo->can_update_info_refs && !has_object_file(&ref->old_oid)) {
1431
+ if (repo->can_update_info_refs && !repo_has_object_file(the_repository, &ref->old_oid)) {
1432
obj = lookup_unknown_object(the_repository, &ref->old_oid);
1433
fprintf(stderr, " fetch %s for %s\n",
1434
oid_to_hex(&ref->old_oid), refname);
@@ -1628,14 +1629,14 @@ static int delete_remote_branch(const char *pattern, int force)
1629
return error("Remote HEAD symrefs too deep");
1630
if (is_null_oid(&head_oid))
1631
return error("Unable to resolve remote HEAD");
1631
- if (!has_object_file(&head_oid))
1632
+ if (!repo_has_object_file(the_repository, &head_oid))
1633
return error("Remote HEAD resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", oid_to_hex(&head_oid));
1634
1635
/* Remote branch must resolve to a known object */
1636
if (is_null_oid(&remote_ref->old_oid))
1637
return error("Unable to resolve remote branch %s",
1638
remote_ref->name);
1638
- if (!has_object_file(&remote_ref->old_oid))
1639
+ if (!repo_has_object_file(the_repository, &remote_ref->old_oid))
1640
return error("Remote branch %s resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", remote_ref->name, oid_to_hex(&remote_ref->old_oid));
1641
1642
/* Remote branch must be an ancestor of remote HEAD */
@@ -1855,7 +1856,7 @@ int cmd_main(int argc, const char **argv)
1856
if (!force_all &&
1857
!is_null_oid(&ref->old_oid) &&
1858
!ref->force) {
1858
- if (!has_object_file(&ref->old_oid) ||
1859
+ if (!repo_has_object_file(the_repository, &ref->old_oid) ||
1860
!ref_newer(&ref->peer_ref->new_oid,
1861
&ref->old_oid)) {
1862
/*
http-walker.c
+2
-2
@@ -135,7 +135,7 @@ static int fill_active_slot(struct walker *walker)
135
list_for_each_safe(pos, tmp, head) {
136
obj_req = list_entry(pos, struct object_request, node);
137
if (obj_req->state == WAITING) {
138
- if (has_object_file(&obj_req->oid))
138
+ if (repo_has_object_file(the_repository, &obj_req->oid))
139
obj_req->state = COMPLETE;
140
else {
141
start_object_request(walker, obj_req);
@@ -492,7 +492,7 @@ static int fetch_object(struct walker *walker, unsigned char *hash)
492
if (!obj_req)
493
return error("Couldn't find request for %s in the queue", hex);
494
495
- if (has_object_file(&obj_req->oid)) {
495
+ if (repo_has_object_file(the_repository, &obj_req->oid)) {
496
if (obj_req->req)
497
abort_http_object_request(obj_req->req);
498
abort_object_request(obj_req);
list-objects.c
+1
-1
@@ -64,7 +64,7 @@ static void process_blob(struct traversal_context *ctx,
64
* of missing objects.
65
*/
66
if (ctx->revs->exclude_promisor_objects &&
67
- !has_object_file(&obj->oid) &&
67
+ !repo_has_object_file(the_repository, &obj->oid) &&
68
is_promisor_object(&obj->oid))
69
return;
70
mailmap.c
+1
-1
@@ -216,7 +216,7 @@ static int read_mailmap_blob(struct string_list *map, const char *name)
216
if (repo_get_oid(the_repository, name, &oid) < 0)
217
return 0;
218
219
- buf = read_object_file(&oid, &type, &size);
219
+ buf = repo_read_object_file(the_repository, &oid, &type, &size);
220
if (!buf)
221
return error("unable to read mailmap object at %s", name);
222
if (type != OBJ_BLOB)
match-trees.c
+2
-2
@@ -55,7 +55,7 @@ static void *fill_tree_desc_strict(struct tree_desc *desc,
55
enum object_type type;
56
unsigned long size;
57
58
- buffer = read_object_file(hash, &type, &size);
58
+ buffer = repo_read_object_file(the_repository, hash, &type, &size);
59
if (!buffer)
60
die("unable to read tree (%s)", oid_to_hex(hash));
61
if (type != OBJ_TREE)
@@ -188,7 +188,7 @@ static int splice_tree(const struct object_id *oid1, const char *prefix,
188
if (*subpath)
189
subpath++;
190
191
- buf = read_object_file(oid1, &type, &sz);
191
+ buf = repo_read_object_file(the_repository, oid1, &type, &sz);
192
if (!buf)
193
die("cannot read tree %s", oid_to_hex(oid1));
194
init_tree_desc(&desc, buf, sz);
merge-blobs.c
+4
-2
@@ -12,7 +12,8 @@ static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
12
unsigned long size;
13
enum object_type type;
14
15
- buf = read_object_file(&obj->object.oid, &type, &size);
15
+ buf = repo_read_object_file(the_repository, &obj->object.oid, &type,
16
+ &size);
17
if (!buf)
18
return -1;
19
if (type != OBJ_BLOB) {
@@ -78,7 +79,8 @@ void *merge_blobs(struct index_state *istate, const char *path,
79
return NULL;
80
if (!our)
81
our = their;
81
- return read_object_file(&our->object.oid, &type, size);
82
+ return repo_read_object_file(the_repository, &our->object.oid,
83
+ &type, size);
84
}
85
86
if (fill_mmfile_blob(&f1, our) < 0)
merge-ort.c
+1
-1
@@ -3505,7 +3505,7 @@ static int read_oid_strbuf(struct merge_options *opt,
3505
void *buf;
3506
enum object_type type;
3507
unsigned long size;
3508
- buf = read_object_file(oid, &type, &size);
3508
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
3509
if (!buf)
3510
return err(opt, _("cannot read object %s"), oid_to_hex(oid));
3511
if (type != OBJ_BLOB) {
merge-recursive.c
+3
-2
@@ -951,7 +951,8 @@ static int update_file_flags(struct merge_options *opt,
951
goto update_index;
952
}
953
954
- buf = read_object_file(&contents->oid, &type, &size);
954
+ buf = repo_read_object_file(the_repository, &contents->oid,
955
+ &type, &size);
956
if (!buf) {
957
ret = err(opt, _("cannot read object %s '%s'"),
958
oid_to_hex(&contents->oid), path);
@@ -3021,7 +3022,7 @@ static int read_oid_strbuf(struct merge_options *opt,
3022
void *buf;
3023
enum object_type type;
3024
unsigned long size;
3024
- buf = read_object_file(oid, &type, &size);
3025
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
3026
if (!buf)
3027
return err(opt, _("cannot read object %s"), oid_to_hex(oid));
3028
if (type != OBJ_BLOB) {
notes-cache.c
+1
-1
@@ -81,7 +81,7 @@ char *notes_cache_get(struct notes_cache *c, struct object_id *key_oid,
81
value_oid = get_note(&c->tree, key_oid);
82
if (!value_oid)
83
return NULL;
84
- value = read_object_file(value_oid, &type, &size);
84
+ value = repo_read_object_file(the_repository, value_oid, &type, &size);
85
86
*outsize = size;
87
return value;
notes-merge.c
+1
-1
@@ -326,7 +326,7 @@ static void write_note_to_worktree(const struct object_id *obj,
326
{
327
enum object_type type;
328
unsigned long size;
329
- void *buf = read_object_file(note, &type, &size);
329
+ void *buf = repo_read_object_file(the_repository, note, &type, &size);
330
331
if (!buf)
332
die("cannot read note %s for object %s",
notes.c
+7
-5
@@ -786,7 +786,7 @@ static int prune_notes_helper(const struct object_id *object_oid,
786
struct note_delete_list **l = (struct note_delete_list **) cb_data;
787
struct note_delete_list *n;
788
789
- if (has_object_file(object_oid))
789
+ if (repo_has_object_file(the_repository, object_oid))
790
return 0; /* nothing to do for this note */
791
792
/* failed to find object => prune this note */
@@ -807,13 +807,15 @@ int combine_notes_concatenate(struct object_id *cur_oid,
807
808
/* read in both note blob objects */
809
if (!is_null_oid(new_oid))
810
- new_msg = read_object_file(new_oid, &new_type, &new_len);
810
+ new_msg = repo_read_object_file(the_repository, new_oid,
811
+ &new_type, &new_len);
812
if (!new_msg || !new_len || new_type != OBJ_BLOB) {
813
free(new_msg);
814
return 0;
815
}
816
if (!is_null_oid(cur_oid))
816
- cur_msg = read_object_file(cur_oid, &cur_type, &cur_len);
817
+ cur_msg = repo_read_object_file(the_repository, cur_oid,
818
+ &cur_type, &cur_len);
819
if (!cur_msg || !cur_len || cur_type != OBJ_BLOB) {
820
free(cur_msg);
821
free(new_msg);
@@ -869,7 +871,7 @@ static int string_list_add_note_lines(struct string_list *list,
871
return 0;
872
873
/* read_sha1_file NUL-terminates */
872
- data = read_object_file(oid, &t, &len);
874
+ data = repo_read_object_file(the_repository, oid, &t, &len);
875
if (t != OBJ_BLOB || !data || !len) {
876
free(data);
877
return t != OBJ_BLOB || !data;
@@ -1264,7 +1266,7 @@ static void format_note(struct notes_tree *t, const struct object_id *object_oid
1266
if (!oid)
1267
return;
1268
1267
- if (!(msg = read_object_file(oid, &type, &msglen)) || type != OBJ_BLOB) {
1269
+ if (!(msg = repo_read_object_file(the_repository, oid, &type, &msglen)) || type != OBJ_BLOB) {
1270
free(msg);
1271
return;
1272
}
object-file.c
+1
-1
@@ -1678,7 +1678,7 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,
1678
struct cached_object *co;
1679
1680
hash_object_file(the_hash_algo, buf, len, type, oid);
1681
- if (has_object_file_with_flags(oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||
1681
+ if (repo_has_object_file_with_flags(the_repository, oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||
1682
find_cached_object(oid))
1683
return 0;
1684
ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
object-store.h
-7
@@ -245,9 +245,6 @@ void *repo_read_object_file(struct repository *r,
245
const struct object_id *oid,
246
enum object_type *type,
247
unsigned long *size);
248
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
249
-#define read_object_file(oid, type, size) repo_read_object_file(the_repository, oid, type, size)
250
-#endif
248
249
/* Read and unpack an object file into memory, write memory to an object file */
250
int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);
@@ -324,10 +321,6 @@ int has_object(struct repository *r, const struct object_id *oid,
321
int repo_has_object_file(struct repository *r, const struct object_id *oid);
322
int repo_has_object_file_with_flags(struct repository *r,
323
const struct object_id *oid, int flags);
327
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
328
-#define has_object_file(oid) repo_has_object_file(the_repository, oid)
329
-#define has_object_file_with_flags(oid, flags) repo_has_object_file_with_flags(the_repository, oid, flags)
330
-#endif
324
325
/*
326
* Return true iff an alternate object database has a loose object
read-cache.c
+3
-2
@@ -263,7 +263,7 @@ static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)
263
if (strbuf_readlink(&sb, ce->name, expected_size))
264
return -1;
265
266
- buffer = read_object_file(&ce->oid, &type, &size);
266
+ buffer = repo_read_object_file(the_repository, &ce->oid, &type, &size);
267
if (buffer) {
268
if (size == sb.len)
269
match = memcmp(buffer, sb.buf, size);
@@ -3553,7 +3553,8 @@ void *read_blob_data_from_index(struct index_state *istate,
3553
}
3554
if (pos < 0)
3555
return NULL;
3556
- data = read_object_file(&istate->cache[pos]->oid, &type, &sz);
3556
+ data = repo_read_object_file(the_repository, &istate->cache[pos]->oid,
3557
+ &type, &sz);
3558
if (!data || type != OBJ_BLOB) {
3559
free(data);
3560
return NULL;
reflog.c
+3
-2
@@ -28,7 +28,8 @@ static int tree_is_complete(const struct object_id *oid)
28
if (!tree->buffer) {
29
enum object_type type;
30
unsigned long size;
31
- void *data = read_object_file(oid, &type, &size);
31
+ void *data = repo_read_object_file(the_repository, oid, &type,
32
+ &size);
33
if (!data) {
34
tree->object.flags |= INCOMPLETE;
35
return 0;
@@ -39,7 +40,7 @@ static int tree_is_complete(const struct object_id *oid)
40
init_tree_desc(&desc, tree->buffer, tree->size);
41
complete = 1;
42
while (tree_entry(&desc, &entry)) {
42
- if (!has_object_file(&entry.oid) ||
43
+ if (!repo_has_object_file(the_repository, &entry.oid) ||
44
(S_ISDIR(entry.mode) && !tree_is_complete(&entry.oid))) {
45
tree->object.flags |= INCOMPLETE;
46
complete = 0;
remote.c
+1
-1
@@ -1759,7 +1759,7 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
1759
if (!reject_reason && !ref->deletion && !is_null_oid(&ref->old_oid)) {
1760
if (starts_with(ref->name, "refs/tags/"))
1761
reject_reason = REF_STATUS_REJECT_ALREADY_EXISTS;
1762
- else if (!has_object_file(&ref->old_oid))
1762
+ else if (!repo_has_object_file(the_repository, &ref->old_oid))
1763
reject_reason = REF_STATUS_REJECT_FETCH_FIRST;
1764
else if (!lookup_commit_reference_gently(the_repository, &ref->old_oid, 1) ||
1765
!lookup_commit_reference_gently(the_repository, &ref->new_oid, 1))
rerere.c
+3
-2
@@ -965,8 +965,9 @@ static int handle_cache(struct index_state *istate,
965
break;
966
i = ce_stage(ce) - 1;
967
if (!mmfile[i].ptr) {
968
- mmfile[i].ptr = read_object_file(&ce->oid, &type,
969
- &size);
968
+ mmfile[i].ptr = repo_read_object_file(the_repository,
969
+ &ce->oid, &type,
970
+ &size);
971
mmfile[i].size = size;
972
}
973
}
send-pack.c
+3
-3
@@ -42,9 +42,9 @@ int option_parse_push_signed(const struct option *opt,
42
static void feed_object(const struct object_id *oid, FILE *fh, int negative)
43
{
44
if (negative &&
45
- !has_object_file_with_flags(oid,
46
- OBJECT_INFO_SKIP_FETCH_OBJECT |
47
- OBJECT_INFO_QUICK))
45
+ !repo_has_object_file_with_flags(the_repository, oid,
46
+ OBJECT_INFO_SKIP_FETCH_OBJECT |
47
+ OBJECT_INFO_QUICK))
48
return;
49
50
if (negative)
shallow.c
+3
-3
@@ -301,7 +301,7 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
301
if (graft->nr_parent != -1)
302
return 0;
303
if (data->flags & QUICK) {
304
- if (!has_object_file(&graft->oid))
304
+ if (!repo_has_object_file(the_repository, &graft->oid))
305
return 0;
306
} else if (data->flags & SEEN_ONLY) {
307
struct commit *c = lookup_commit(the_repository, &graft->oid);
@@ -466,7 +466,7 @@ void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa)
466
ALLOC_ARRAY(info->ours, sa->nr);
467
ALLOC_ARRAY(info->theirs, sa->nr);
468
for (i = 0; i < sa->nr; i++) {
469
- if (has_object_file(sa->oid + i)) {
469
+ if (repo_has_object_file(the_repository, sa->oid + i)) {
470
struct commit_graft *graft;
471
graft = lookup_commit_graft(the_repository,
472
&sa->oid[i]);
@@ -494,7 +494,7 @@ void remove_nonexistent_theirs_shallow(struct shallow_info *info)
494
for (i = dst = 0; i < info->nr_theirs; i++) {
495
if (i != dst)
496
info->theirs[dst] = info->theirs[i];
497
- if (has_object_file(oid + info->theirs[i]))
497
+ if (repo_has_object_file(the_repository, oid + info->theirs[i]))
498
dst++;
499
}
500
info->nr_theirs = dst;
submodule-config.c
+2
-1
@@ -588,7 +588,8 @@ static const struct submodule *config_from(struct submodule_cache *cache,
588
if (submodule)
589
goto out;
590
591
- config = read_object_file(&oid, &type, &config_size);
591
+ config = repo_read_object_file(the_repository, &oid, &type,
592
+ &config_size);
593
if (!config || type != OBJ_BLOB)
594
goto out;
595
tag.c
+3
-2
@@ -54,7 +54,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
54
repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV),
55
type_name(type));
56
57
- buf = read_object_file(oid, &type, &size);
57
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
58
if (!buf)
59
return error("%s: unable to read file.",
60
name_to_report ?
@@ -216,7 +216,8 @@ int parse_tag(struct tag *item)
216
217
if (item->object.parsed)
218
return 0;
219
- data = read_object_file(&item->object.oid, &type, &size);
219
+ data = repo_read_object_file(the_repository, &item->object.oid, &type,
220
+ &size);
221
if (!data)
222
return error("Could not read %s",
223
oid_to_hex(&item->object.oid));
tree.c
+2
-1
@@ -129,7 +129,8 @@ int parse_tree_gently(struct tree *item, int quiet_on_missing)
129
130
if (item->object.parsed)
131
return 0;
132
- buffer = read_object_file(&item->object.oid, &type, &size);
132
+ buffer = repo_read_object_file(the_repository, &item->object.oid,
133
+ &type, &size);
134
if (!buffer)
135
return quiet_on_missing ? -1 :
136
error("Could not read %s",
upload-pack.c
+4
-4
@@ -499,8 +499,8 @@ static int got_oid(struct upload_pack_data *data,
499
{
500
if (get_oid_hex(hex, oid))
501
die("git upload-pack: expected SHA1 object, got '%s'", hex);
502
- if (!has_object_file_with_flags(oid,
503
- OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
502
+ if (!repo_has_object_file_with_flags(the_repository, oid,
503
+ OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
504
return -1;
505
return do_got_oid(data, oid);
506
}
@@ -1600,8 +1600,8 @@ static int process_haves(struct upload_pack_data *data, struct oid_array *common
1600
for (i = 0; i < data->haves.nr; i++) {
1601
const struct object_id *oid = &data->haves.oid[i];
1602
1603
- if (!has_object_file_with_flags(oid,
1604
- OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
1603
+ if (!repo_has_object_file_with_flags(the_repository, oid,
1604
+ OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
1605
continue;
1606
1607
oid_array_append(common, oid);
walker.c
+1
-1
@@ -145,7 +145,7 @@ static int process(struct walker *walker, struct object *obj)
145
return 0;
146
obj->flags |= SEEN;
147
148
- if (has_object_file(&obj->oid)) {
148
+ if (repo_has_object_file(the_repository, &obj->oid)) {
149
/* We already have it, so we should scan it now. */
150
obj->flags |= TO_SCAN;
151
}
xdiff-interface.c
+1
-1
@@ -183,7 +183,7 @@ void read_mmblob(mmfile_t *ptr, const struct object_id *oid)
183
return;
184
}
185
186
- ptr->ptr = read_object_file(oid, &type, &size);
186
+ ptr->ptr = repo_read_object_file(the_repository, oid, &type, &size);
187
if (!ptr->ptr || type != OBJ_BLOB)
188
die("unable to read blob object %s", oid_to_hex(oid));
189
ptr->size = size;