Skip to content

Commit 0dd1f0c

Browse files
pcloudsgitster
authored andcommitted
tree-walk.c: remove the_repo from get_tree_entry_follow_symlinks()
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 50ddb08 commit 0dd1f0c

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

sha1-name.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,16 +1890,8 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
18901890
new_filename = resolve_relative_path(repo, filename);
18911891
if (new_filename)
18921892
filename = new_filename;
1893-
/*
1894-
* NEEDSWORK: Eventually get_tree_entry*() should
1895-
* learn to take struct repository directly and we
1896-
* would not need to inject submodule odb to the
1897-
* in-core odb.
1898-
*/
1899-
if (repo != the_repository)
1900-
add_to_alternates_memory(repo->objects->odb->path);
19011893
if (flags & GET_OID_FOLLOW_SYMLINKS) {
1902-
ret = get_tree_entry_follow_symlinks(&tree_oid,
1894+
ret = get_tree_entry_follow_symlinks(repo, &tree_oid,
19031895
filename, oid, &oc->symlink_path,
19041896
&oc->mode);
19051897
} else {

tree-walk.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,10 @@ int get_tree_entry(struct repository *r,
593593
* See the code for enum get_oid_result for a description of
594594
* the return values.
595595
*/
596-
enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, const char *name, struct object_id *result, struct strbuf *result_path, unsigned short *mode)
596+
enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r,
597+
struct object_id *tree_oid, const char *name,
598+
struct object_id *result, struct strbuf *result_path,
599+
unsigned short *mode)
597600
{
598601
int retval = MISSING_OBJECT;
599602
struct dir_state *parents = NULL;
@@ -617,7 +620,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
617620
void *tree;
618621
struct object_id root;
619622
unsigned long size;
620-
tree = read_object_with_reference(the_repository,
623+
tree = read_object_with_reference(r,
621624
&current_tree_oid,
622625
tree_type, &size,
623626
&root);
@@ -687,7 +690,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
687690
}
688691

689692
/* Look up the first (or only) path component in the tree. */
690-
find_result = find_tree_entry(the_repository, &t, namebuf.buf,
693+
find_result = find_tree_entry(r, &t, namebuf.buf,
691694
&current_tree_oid, mode);
692695
if (find_result) {
693696
goto done;
@@ -731,7 +734,8 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
731734
*/
732735
retval = DANGLING_SYMLINK;
733736

734-
contents = read_object_file(&current_tree_oid, &type,
737+
contents = repo_read_object_file(r,
738+
&current_tree_oid, &type,
735739
&link_len);
736740

737741
if (!contents)

tree-walk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct traverse_info;
5353
typedef int (*traverse_callback_t)(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *);
5454
int traverse_trees(struct index_state *istate, int n, struct tree_desc *t, struct traverse_info *info);
5555

56-
enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, const char *name, struct object_id *result, struct strbuf *result_path, unsigned short *mode);
56+
enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r, struct object_id *tree_oid, const char *name, struct object_id *result, struct strbuf *result_path, unsigned short *mode);
5757

5858
struct traverse_info {
5959
const char *traverse_path;

0 commit comments

Comments
 (0)