diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-05-17 10:18:39 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-05-17 19:33:38 +0200 |
commit | e19488a60aab022ca4c8d32d6629c04ce94f2779 (patch) | |
tree | c1d38f4475913be4d2033a2cd902d2f53a61cc35 /read-cache.c | |
parent | refs: pass repo when retrieving submodule ref store (diff) | |
download | git-e19488a60aab022ca4c8d32d6629c04ce94f2779.tar.xz git-e19488a60aab022ca4c8d32d6629c04ce94f2779.zip |
refs: refactor `resolve_gitlink_ref()` to accept a repository
In `resolve_gitlink_ref()` we implicitly rely on `the_repository` to
look up the submodule ref store. Now that we can look up submodule ref
stores for arbitrary repositories we can improve this function to
instead accept a repository as parameter for which we want to resolve
the gitlink.
Do so and adjust callers accordingly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c index a6db25a16d..447109aa76 100644 --- a/read-cache.c +++ b/read-cache.c @@ -271,7 +271,8 @@ static int ce_compare_gitlink(const struct cache_entry *ce) * * If so, we consider it always to match. */ - if (resolve_gitlink_ref(ce->name, "HEAD", &oid) < 0) + if (repo_resolve_gitlink_ref(the_repository, ce->name, + "HEAD", &oid) < 0) return 0; return !oideq(&oid, &ce->oid); } @@ -711,7 +712,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st, namelen = strlen(path); if (S_ISDIR(st_mode)) { - if (resolve_gitlink_ref(path, "HEAD", &oid) < 0) + if (repo_resolve_gitlink_ref(the_repository, path, "HEAD", &oid) < 0) return error(_("'%s' does not have a commit checked out"), path); while (namelen && path[namelen-1] == '/') namelen--; |