Skip to content

Commit efe461b

Browse files
pcloudsgitster
authored andcommitted
sha1-name.c: remove the_repo from get_oid_with_context_1()
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0381f7f commit efe461b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

sha1-name.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "packfile.h"
1313
#include "object-store.h"
1414
#include "repository.h"
15+
#include "submodule.h"
1516
#include "midx.h"
1617
#include "commit-reach.h"
1718

@@ -1797,7 +1798,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
17971798
oc->path = xstrdup(cp);
17981799

17991800
if (!repo->index->cache)
1800-
repo_read_index(the_repository);
1801+
repo_read_index(repo);
18011802
pos = index_name_pos(repo->index, cp, namelen);
18021803
if (pos < 0)
18031804
pos = -pos - 1;
@@ -1842,6 +1843,14 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
18421843
new_filename = resolve_relative_path(repo, filename);
18431844
if (new_filename)
18441845
filename = new_filename;
1846+
/*
1847+
* NEEDSWORK: Eventually get_tree_entry*() should
1848+
* learn to take struct repository directly and we
1849+
* would not need to inject submodule odb to the
1850+
* in-core odb.
1851+
*/
1852+
if (repo != the_repository)
1853+
add_to_alternates_memory(repo->objects->odb->path);
18451854
if (flags & GET_OID_FOLLOW_SYMLINKS) {
18461855
ret = get_tree_entry_follow_symlinks(&tree_oid,
18471856
filename, oid, &oc->symlink_path,

0 commit comments

Comments
 (0)