summaryrefslogtreecommitdiff
path: root/repository.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2021-09-15 18:59:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-15 19:59:12 (GMT)
commitce125d431aaa7a12623a81267a221f64552ffd17 (patch)
tree11213b56eacb5df3cdbfc1c7291e02ba6d8da3a2 /repository.c
parent8b7c11b8668b4e774f81a9f0b4c30144b818f1d1 (diff)
downloadgit-ce125d431aaa7a12623a81267a221f64552ffd17.zip
git-ce125d431aaa7a12623a81267a221f64552ffd17.tar.gz
git-ce125d431aaa7a12623a81267a221f64552ffd17.tar.bz2
submodule: extract path to submodule gitdir func
We currently store each submodule gitdir in ".git/modules/<name>", but this has problems with some submodule naming schemes, as described in a comment in submodule_name_to_gitdir() in this patch. Extract the determination of the location of a submodule's gitdir into its own function submodule_name_to_gitdir(). For now, the problem remains unsolved, but this puts us in a better position for finding a solution. This was motivated, at $DAYJOB, by a part of Android's repo hierarchy [1]. In particular, there is a repo "build", and several repos of the form "build/<name>". This is based on earlier work by Brandon Williams [2]. [1] https://android.googlesource.com/platform/ [2] https://lore.kernel.org/git/20180808223323.79989-2-bmwill@google.com/ Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/repository.c b/repository.c
index b2bf44c..710a3b4 100644
--- a/repository.c
+++ b/repository.c
@@ -213,8 +213,7 @@ int repo_submodule_init(struct repository *subrepo,
* submodule would not have a worktree.
*/
strbuf_reset(&gitdir);
- strbuf_repo_git_path(&gitdir, superproject,
- "modules/%s", sub->name);
+ submodule_name_to_gitdir(&gitdir, superproject, sub->name);
if (repo_init(subrepo, gitdir.buf, NULL)) {
ret = -1;