From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 4/6] tree-walk.c: remove the_repo from get_tree_entry_follow_symlinks()
Date: Mon, 24 Jun 2019 16:55:31 +0700 [thread overview]
Message-ID: <20190624095533.22162-5-pclouds@gmail.com> (raw)
In-Reply-To: <20190624095533.22162-1-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
sha1-name.c | 10 +---------
tree-walk.c | 12 ++++++++----
tree-walk.h | 2 +-
3 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/sha1-name.c b/sha1-name.c
index e8fb215e5c..3c9fa10af8 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -1890,16 +1890,8 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
new_filename = resolve_relative_path(repo, filename);
if (new_filename)
filename = new_filename;
- /*
- * NEEDSWORK: Eventually get_tree_entry*() should
- * learn to take struct repository directly and we
- * would not need to inject submodule odb to the
- * in-core odb.
- */
- if (repo != the_repository)
- add_to_alternates_memory(repo->objects->odb->path);
if (flags & GET_OID_FOLLOW_SYMLINKS) {
- ret = get_tree_entry_follow_symlinks(&tree_oid,
+ ret = get_tree_entry_follow_symlinks(repo, &tree_oid,
filename, oid, &oc->symlink_path,
&oc->mode);
} else {
diff --git a/tree-walk.c b/tree-walk.c
index 506e12a031..c20b62f49e 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -593,7 +593,10 @@ int get_tree_entry(struct repository *r,
* See the code for enum get_oid_result for a description of
* the return values.
*/
-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)
+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)
{
int retval = MISSING_OBJECT;
struct dir_state *parents = NULL;
@@ -617,7 +620,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
void *tree;
struct object_id root;
unsigned long size;
- tree = read_object_with_reference(the_repository,
+ tree = read_object_with_reference(r,
¤t_tree_oid,
tree_type, &size,
&root);
@@ -687,7 +690,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
}
/* Look up the first (or only) path component in the tree. */
- find_result = find_tree_entry(the_repository, &t, namebuf.buf,
+ find_result = find_tree_entry(r, &t, namebuf.buf,
¤t_tree_oid, mode);
if (find_result) {
goto done;
@@ -731,7 +734,8 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
*/
retval = DANGLING_SYMLINK;
- contents = read_object_file(¤t_tree_oid, &type,
+ contents = repo_read_object_file(r,
+ ¤t_tree_oid, &type,
&link_len);
if (!contents)
diff --git a/tree-walk.h b/tree-walk.h
index 639f79187f..2a5db29e8f 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -53,7 +53,7 @@ struct traverse_info;
typedef int (*traverse_callback_t)(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *);
int traverse_trees(struct index_state *istate, int n, struct tree_desc *t, struct traverse_info *info);
-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);
+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);
struct traverse_info {
const char *traverse_path;
--
2.22.0.rc0.322.g2b0371e29a
next prev parent reply other threads:[~2019-06-24 9:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 9:55 [PATCH 0/6] Kill the_repository in tree-walk.c Nguyễn Thái Ngọc Duy
2019-06-24 9:55 ` [PATCH 1/6] sha1-file.c: remove the_repo from read_object_with_reference() Nguyễn Thái Ngọc Duy
2019-06-27 12:54 ` Johannes Schindelin
2019-06-27 13:12 ` Duy Nguyen
2019-06-24 9:55 ` [PATCH 2/6] tree-walk.c: remove the_repo from fill_tree_descriptor() Nguyễn Thái Ngọc Duy
2019-06-24 13:30 ` Derrick Stolee
2019-06-26 16:27 ` Junio C Hamano
2019-06-26 16:47 ` Derrick Stolee
2019-06-24 9:55 ` [PATCH 3/6] tree-walk.c: remove the_repo from get_tree_entry() Nguyễn Thái Ngọc Duy
2019-06-24 14:20 ` Derrick Stolee
2019-06-24 14:55 ` Duy Nguyen
2019-06-24 9:55 ` Nguyễn Thái Ngọc Duy [this message]
2019-06-24 9:55 ` [PATCH 5/6] match-trees.c: remove the_repo from shift_tree*() Nguyễn Thái Ngọc Duy
2019-06-24 9:55 ` [PATCH 6/6] Use the right 'struct repository' instead of the_repository Nguyễn Thái Ngọc Duy
2019-06-24 14:24 ` Derrick Stolee
2019-06-24 14:45 ` Duy Nguyen
2019-06-27 9:06 ` Johannes Schindelin
2019-06-26 17:20 ` [PATCH 0/6] Kill the_repository in tree-walk.c Junio C Hamano
2019-06-27 13:04 ` Johannes Schindelin
2019-06-27 17:09 ` Derrick Stolee
2019-06-27 9:28 ` [PATCH v2 " Nguyễn Thái Ngọc Duy
2019-06-27 9:28 ` [PATCH v2 1/6] sha1-file.c: remove the_repo from read_object_with_reference() Nguyễn Thái Ngọc Duy
2019-06-28 12:46 ` Johannes Schindelin
2019-06-27 9:28 ` [PATCH v2 2/6] tree-walk.c: remove the_repo from fill_tree_descriptor() Nguyễn Thái Ngọc Duy
2019-06-27 9:28 ` [PATCH v2 3/6] tree-walk.c: remove the_repo from get_tree_entry() Nguyễn Thái Ngọc Duy
2019-06-27 9:28 ` [PATCH v2 4/6] tree-walk.c: remove the_repo from get_tree_entry_follow_symlinks() Nguyễn Thái Ngọc Duy
2019-06-27 9:28 ` [PATCH v2 5/6] match-trees.c: remove the_repo from shift_tree*() Nguyễn Thái Ngọc Duy
2019-06-27 9:28 ` [PATCH v2 6/6] Use the right 'struct repository' instead of the_repository Nguyễn Thái Ngọc Duy
2019-06-27 19:44 ` [PATCH v2 0/6] Kill the_repository in tree-walk.c Junio C Hamano
2019-06-28 9:35 ` [PATCH v2 7/6] t7814: do not generate same commits in different repos Nguyễn Thái Ngọc Duy
2019-06-28 16:17 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190624095533.22162-5-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).