Skip to content

Commit d3b4705

Browse files
pcloudsgitster
authored andcommitted
sha1-file.c: remove the_repo from read_object_with_reference()
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8dca754 commit d3b4705

File tree

7 files changed

+23
-13
lines changed

7 files changed

+23
-13
lines changed

builtin/cat-file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
172172
* fall-back to the usual case.
173173
*/
174174
}
175-
buf = read_object_with_reference(&oid, exp_type, &size, NULL);
175+
buf = read_object_with_reference(the_repository,
176+
&oid, exp_type, &size, NULL);
176177
break;
177178

178179
default:

builtin/grep.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ static int grep_submodule(struct grep_opt *opt,
458458
object = parse_object_or_die(oid, oid_to_hex(oid));
459459

460460
grep_read_lock();
461-
data = read_object_with_reference(&object->oid, tree_type,
461+
data = read_object_with_reference(&subrepo,
462+
&object->oid, tree_type,
462463
&size, NULL);
463464
grep_read_unlock();
464465

@@ -623,7 +624,8 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
623624
int hit, len;
624625

625626
grep_read_lock();
626-
data = read_object_with_reference(&obj->oid, tree_type,
627+
data = read_object_with_reference(opt->repo,
628+
&obj->oid, tree_type,
627629
&size, NULL);
628630
grep_read_unlock();
629631

builtin/pack-objects.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,8 @@ static void add_preferred_base(struct object_id *oid)
14281428
if (window <= num_preferred_base++)
14291429
return;
14301430

1431-
data = read_object_with_reference(oid, tree_type, &size, &tree_oid);
1431+
data = read_object_with_reference(the_repository, oid,
1432+
tree_type, &size, &tree_oid);
14321433
if (!data)
14331434
return;
14341435

cache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,8 @@ int df_name_compare(const char *name1, int len1, int mode1, const char *name2, i
15001500
int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);
15011501
int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);
15021502

1503-
void *read_object_with_reference(const struct object_id *oid,
1503+
void *read_object_with_reference(struct repository *r,
1504+
const struct object_id *oid,
15041505
const char *required_type,
15051506
unsigned long *size,
15061507
struct object_id *oid_ret);

fast-import.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,7 +2410,8 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
24102410
oidcpy(&commit_oid, &commit_oe->idx.oid);
24112411
} else if (!get_oid(p, &commit_oid)) {
24122412
unsigned long size;
2413-
char *buf = read_object_with_reference(&commit_oid,
2413+
char *buf = read_object_with_reference(the_repository,
2414+
&commit_oid,
24142415
commit_type, &size,
24152416
&commit_oid);
24162417
if (!buf || size < the_hash_algo->hexsz + 6)
@@ -2482,7 +2483,8 @@ static void parse_from_existing(struct branch *b)
24822483
unsigned long size;
24832484
char *buf;
24842485

2485-
buf = read_object_with_reference(&b->oid, commit_type, &size,
2486+
buf = read_object_with_reference(the_repository,
2487+
&b->oid, commit_type, &size,
24862488
&b->oid);
24872489
parse_from_commit(b, buf, size);
24882490
free(buf);
@@ -2560,7 +2562,8 @@ static struct hash_list *parse_merge(unsigned int *count)
25602562
oidcpy(&n->oid, &oe->idx.oid);
25612563
} else if (!get_oid(from, &n->oid)) {
25622564
unsigned long size;
2563-
char *buf = read_object_with_reference(&n->oid,
2565+
char *buf = read_object_with_reference(the_repository,
2566+
&n->oid,
25642567
commit_type,
25652568
&size, &n->oid);
25662569
if (!buf || size < the_hash_algo->hexsz + 6)

sha1-file.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,8 @@ void *read_object_file_extended(struct repository *r,
15051505
return NULL;
15061506
}
15071507

1508-
void *read_object_with_reference(const struct object_id *oid,
1508+
void *read_object_with_reference(struct repository *r,
1509+
const struct object_id *oid,
15091510
const char *required_type_name,
15101511
unsigned long *size,
15111512
struct object_id *actual_oid_return)
@@ -1521,7 +1522,7 @@ void *read_object_with_reference(const struct object_id *oid,
15211522
int ref_length = -1;
15221523
const char *ref_type = NULL;
15231524

1524-
buffer = read_object_file(&actual_oid, &type, &isize);
1525+
buffer = repo_read_object_file(r, &actual_oid, &type, &isize);
15251526
if (!buffer)
15261527
return NULL;
15271528
if (type == required_type) {

tree-walk.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void *fill_tree_descriptor(struct tree_desc *desc, const struct object_id *oid)
8787
void *buf = NULL;
8888

8989
if (oid) {
90-
buf = read_object_with_reference(oid, tree_type, &size, NULL);
90+
buf = read_object_with_reference(the_repository, oid, tree_type, &size, NULL);
9191
if (!buf)
9292
die("unable to read tree %s", oid_to_hex(oid));
9393
}
@@ -542,7 +542,7 @@ int get_tree_entry(const struct object_id *tree_oid, const char *name, struct ob
542542
unsigned long size;
543543
struct object_id root;
544544

545-
tree = read_object_with_reference(tree_oid, tree_type, &size, &root);
545+
tree = read_object_with_reference(the_repository, tree_oid, tree_type, &size, &root);
546546
if (!tree)
547547
return -1;
548548

@@ -609,7 +609,8 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
609609
void *tree;
610610
struct object_id root;
611611
unsigned long size;
612-
tree = read_object_with_reference(&current_tree_oid,
612+
tree = read_object_with_reference(the_repository,
613+
&current_tree_oid,
613614
tree_type, &size,
614615
&root);
615616
if (!tree)

0 commit comments

Comments
 (0)