diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2021-09-15 20:59:19 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-15 21:59:12 +0200 |
commit | ce125d431aaa7a12623a81267a221f64552ffd17 (patch) | |
tree | 11213b56eacb5df3cdbfc1c7291e02ba6d8da3a2 /submodule.h | |
parent | The fifth batch (diff) | |
download | git-ce125d431aaa7a12623a81267a221f64552ffd17.tar.xz git-ce125d431aaa7a12623a81267a221f64552ffd17.zip |
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 'submodule.h')
-rw-r--r-- | submodule.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/submodule.h b/submodule.h index 84640c49c1..c11e0807fc 100644 --- a/submodule.h +++ b/submodule.h @@ -125,6 +125,13 @@ int push_unpushed_submodules(struct repository *r, int submodule_to_gitdir(struct strbuf *buf, const char *submodule); /* + * Given a submodule name, create a path to where the submodule's gitdir lives + * inside of the provided repository's 'modules' directory. + */ +void submodule_name_to_gitdir(struct strbuf *buf, struct repository *r, + const char *submodule_name); + +/* * Make sure that no submodule's git dir is nested in a sibling submodule's. */ int validate_submodule_git_dir(char *git_dir, const char *submodule_name); |