diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-02-07 12:03:30 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-07 09:59:22 -0800 |
| commit | f5c714e2a7d6239548b94c37ae906484e94b5bc7 (patch) | |
| tree | 54c3d9505625ccfd8b921c858742c89ed33fac15 /t | |
| parent | f9467895d884908d5588fc920997b2e53dfb3302 (diff) | |
| download | git-f5c714e2a7d6239548b94c37ae906484e94b5bc7.tar.gz | |
path: refactor `repo_submodule_path()` family of functions
As explained in an earlier commit, we're refactoring path-related
functions to provide a consistent interface for computing paths into the
commondir, gitdir and worktree. Refactor the "submodule" family of
functions accordingly.
Note that in contrast to the other `repo_*_path()` families, we have to
pass in the repository as a non-constant pointer. This is because we end
up calling `repo_read_gitmodules()` deep down in the callstack, which
may end up modifying the repository.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
| -rw-r--r-- | t/helper/test-ref-store.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c index 1cc05f043a..e00fce592b 100644 --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@ -75,11 +75,10 @@ static const char **get_store(const char **argv, struct ref_store **refs) *refs = get_main_ref_store(the_repository); } else if (skip_prefix(argv[0], "submodule:", &gitdir)) { struct strbuf sb = STRBUF_INIT; - int ret; - ret = strbuf_git_path_submodule(&sb, gitdir, "objects/"); - if (ret) - die("strbuf_git_path_submodule failed: %d", ret); + if (!repo_submodule_path_append(the_repository, + &sb, gitdir, "objects/")) + die("computing submodule path failed"); add_to_alternates_memory(sb.buf); strbuf_release(&sb); |
