tree-walk.c: remove the_repo from get_tree_entry_follow_symlinks()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Jun 27, 2019 at 16:28 UTC 0dd1f0c3a60161db7908472eff43e948711ce9bd
3 files changed +10 -14
sha1-name.c
+1 -9
@@ -1890,16 +1890,8 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
1890 new_filename = resolve_relative_path(repo, filename);
1891 if (new_filename)
1892 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);
1893 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,
1895 filename, oid, &oc->symlink_path,
1896 &oc->mode);
1897 } else {
tree-walk.c
+8 -4
@@ -593,7 +593,10 @@ int get_tree_entry(struct repository *r,
593 * See the code for enum get_oid_result for a description of
594 * the return values.
595 */
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)
600 {
601 int retval = MISSING_OBJECT;
602 struct dir_state *parents = NULL;
@@ -617,7 +620,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
620 void *tree;
621 struct object_id root;
622 unsigned long size;
620 - tree = read_object_with_reference(the_repository,
623 + tree = read_object_with_reference(r,
624 &current_tree_oid,
625 tree_type, &size,
626 &root);
@@ -687,7 +690,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
690 }
691
692 /* 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,
694 &current_tree_oid, mode);
695 if (find_result) {
696 goto done;
@@ -731,7 +734,8 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
734 */
735 retval = DANGLING_SYMLINK;
736
734 - contents = read_object_file(&current_tree_oid, &type,
737 + contents = repo_read_object_file(r,
738 + &current_tree_oid, &type,
739 &link_len);
740
741 if (!contents)
tree-walk.h
+1 -1
@@ -53,7 +53,7 @@ struct traverse_info;
53 typedef int (*traverse_callback_t)(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *);
54 int traverse_trees(struct index_state *istate, int n, struct tree_desc *t, struct traverse_info *info);
55
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);
57
58 struct traverse_info {
59 const char *traverse_path;