diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-04-16 16:33:36 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-16 18:56:53 +0900 |
commit | efe461b0811352b539e2cc4721aa5efcf11f0255 (patch) | |
tree | a41e61f7a22f40f0a4e913d8399e027ca90310f5 | |
parent | sha1-name.c: remove the_repo from resolve_relative_path() (diff) | |
download | tgif-efe461b0811352b539e2cc4721aa5efcf11f0255.tar.xz |
sha1-name.c: remove the_repo from get_oid_with_context_1()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | sha1-name.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sha1-name.c b/sha1-name.c index 6b53ea2eeb..64a50d1291 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -12,6 +12,7 @@ #include "packfile.h" #include "object-store.h" #include "repository.h" +#include "submodule.h" #include "midx.h" #include "commit-reach.h" @@ -1797,7 +1798,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo, oc->path = xstrdup(cp); if (!repo->index->cache) - repo_read_index(the_repository); + repo_read_index(repo); pos = index_name_pos(repo->index, cp, namelen); if (pos < 0) pos = -pos - 1; @@ -1842,6 +1843,14 @@ 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, filename, oid, &oc->symlink_path, |