submodule embedgitdirs
v3 cover submodule embedgitdirs
v3:
* have a slightly more generic function "relocate_gitdir". The recursion is strictly related to submodules, though.
* bail out if a submodule is using worktrees.
This also lays the groundwork for later doing the proper thing, as worktree.h offers a function get_submodule_worktrees(path)
* nit by duy: use git_path instead of git_common_dir
* diff to v2 (as queued by Junio) below.
Stefan Beller (5):
submodule: use absolute path for computing relative path connecting submodule helper: support super prefix test-lib-functions.sh: teach test_commit -C <dir>
worktree: get worktrees from submodules
submodule: add embed-git-dir function
Documentation/git-submodule.txt | 14 ++++++ builtin/submodule--helper.c | 68 ++++++++++++++++++++++++----- dir.c | 78 +++++++++++++++++++++++++++++++++ dir.h | 4 ++ git-submodule.sh | 7 ++- git.c | 2 +- submodule.c | 12 ++--- submodule.h | 1 - t/t7412-submodule-embedgitdirs.sh | 92 +++++++++++++++++++++++++++++++++++++++ t/test-lib-functions.sh | 20 ++++++--- worktree.c | 40 ++++++++++++----- worktree.h | 5 +++ 12 files changed, 309 insertions(+), 34 deletions(-) create mode 100755 t/t7412-submodule-embedgitdirs.sh
v2:
* fixed commit message for patch:
"submodule: use absolute path for computing relative path connecting"
* a new patch "submodule helper: support super prefix"
* redid the final patch with more tests and fixing bugs along the way
* "test-lib-functions.sh: teach test_commit -C <dir>" unchanged
v1:
The discussion of the submodule checkout series revealed to me that a command is needed to move the git directory from the submodules working tree to be embedded into the superprojects git directory.
So I wrote the code to intern the submodules git dir into the superproject, but whilst writing the code I realized this could be valueable for our use in testing too. So I exposed it via the submodule--helper. But as the submodule helper ought to be just an internal API, we could also offer it via the proper submodule command.
The command as it is has little value to the end user for now, but breaking it out of the submodule checkout series hopefully makes review easier.
Thanks,
Stefan
builtin/submodule--helper.c +4 -1
@@ -1081,11 +1081,14 @@ static int embed_git_dir(int argc, const char **argv, const char *prefix)int i;struct pathspec pathspec;struct module_list list =MODULE_LIST_INIT ; +unsigned flags =RELOCATE_GITDIR_RECURSE_SUBMODULES ;struct option embed_gitdir_options[] = {OPT_STRING (0 ,"prefix" , &prefix,N_ ("path" ),N_ ("path into the working tree" )), +OPT_BIT (0 ,"--recursive" , &flags,N_ ("recurse into submodules" ), +RELOCATE_GITDIR_RECURSE_SUBMODULES ),OPT_END () };
@@ -1104,7 +1107,7 @@ static int embed_git_dir(int argc, const char **argv, const char *prefix)return 1 ;for (i =0 ; i < list.nr; i++) -migrate_submodule_gitdir (prefix, list.entries[i]->name,1 ); +relocate_gitdir (prefix, list.entries[i]->name, flags);return 0 ; }
dir.c +78 -0
87 lines not on this page · raw message
dir.h +4 -0
@@ -335,4 +335,8 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned longvoid write_untracked_extension (struct strbuf *out,struct untracked_cache *untracked);void add_untracked_cache (struct index_state *istate);void remove_untracked_cache (struct index_state *istate); + +#define RELOCATE_GITDIR_RECURSE_SUBMODULES (1<<0) +extern void relocate_gitdir (const char *prefix,const char *path,unsigned flags); +#endif
submodule.c +0 -65
68 lines not on this page · raw message
submodule.h +0 -3
@@ -74,7 +74,4 @@ int parallel_submodules(void);* retaining any config in the environment. */ void prepare_submodule_repo_env (struct argv_array *out); - -extern void migrate_submodule_gitdir (const char *prefix, -const char *path,int recursive);#endif
t/t7412-submodule-embedgitdirs.sh +15 -0
@@ -74,4 +74,19 @@ test_expect_success 'embedding the git dir fails for incomplete submodules' ' test_cmp expect.2 actual.2 ' +test_expect_success 'setup a submodule with multiple worktrees' ' + # first create another unembedded git dir in a new submodule + git init sub3 && + test_commit -C sub3 first && + git submodule add ./sub3 && + test_tick && + git commit -m "add another submodule" && + git -C sub3 worktree add ../sub3_second_work_tree +' + +test_expect_success 'embed a submodule with multiple worktrees' ' + test_must_fail git submodule embedgitdirs sub3 2>error && + test_i18ngrep "not supported" error +' + test_done
worktree.c +30 -10
@@ -72,7 +72,7 @@ static void add_head_info(struct strbuf *head_ref, struct worktree *worktree)/** * get the main worktree */ -static struct worktree *get_main_worktree (void ) +static struct worktree *get_main_worktree (const char *git_common_dir) {struct worktree *worktree =NULL ;struct strbuf path =STRBUF_INIT ;
@@ -81,12 +81,12 @@ static struct worktree *get_main_worktree(void)int is_bare =0 ;int is_detached =0 ; -strbuf_add_absolute_path (&worktree_path,get_git_common_dir ()); +strbuf_add_absolute_path (&worktree_path, git_common_dir); is_bare = !strbuf_strip_suffix (&worktree_path,"/.git" );if (is_bare)strbuf_strip_suffix (&worktree_path,"/." ); -strbuf_addf (&path,"%s/HEAD" ,get_git_common_dir ()); +strbuf_addf (&path,"%s/HEAD" , git_common_dir);if (parse_ref (path.buf, &head_ref, &is_detached) <0 ) goto done;
@@ -109,7 +109,8 @@ static struct worktree *get_main_worktree(void)return worktree; } -static struct worktree *get_linked_worktree (const char *id) +static struct worktree *get_linked_worktree (const char *git_common_dir, +const char *id) {struct worktree *worktree =NULL ;struct strbuf path =STRBUF_INIT ;
@@ -120,7 +121,7 @@ static struct worktree *get_linked_worktree(const char *id)if (!id)die ("Missing linked worktree name" ); -strbuf_git_common_path (&path,"worktrees/%s/gitdir" , id); +strbuf_addf (&path,"%s/worktrees/%s/gitdir" , git_common_dir, id);if (strbuf_read_file (&worktree_path, path.buf,0 ) <=0 )/* invalid gitdir file */ goto done;
@@ -133,7 +134,7 @@ static struct worktree *get_linked_worktree(const char *id) }strbuf_reset (&path); -strbuf_addf (&path,"%s/worktrees/%s/HEAD" ,get_git_common_dir (), id); +strbuf_addf (&path,"%s/worktrees/%s/HEAD" , git_common_dir, id);if (parse_ref (path.buf, &head_ref, &is_detached) <0 ) goto done;
@@ -173,7 +174,7 @@ static void mark_current_worktree(struct worktree **worktrees)free (git_dir); } -struct worktree **get_worktrees (void ) +struct worktree **get_worktrees_internal (const char *git_common_dir) {struct worktree **list =NULL ;struct strbuf path =STRBUF_INIT ;
@@ -183,10 +184,10 @@ struct worktree **get_worktrees(void) list =xmalloc (alloc *sizeof (struct worktree *)); -if ((list[counter] =get_main_worktree ())) +if ((list[counter] =get_main_worktree (git_common_dir))) counter++; -strbuf_addf (&path,"%s/worktrees" ,get_git_common_dir ()); +strbuf_addf (&path,"%s/worktrees" , git_common_dir); dir =opendir (path.buf);strbuf_release (&path);if (dir) {
@@ -195,7 +196,7 @@ struct worktree **get_worktrees(void)if (is_dot_or_dotdot (d->d_name))continue ; -if ((linked =get_linked_worktree (d->d_name))) { +if ((linked =get_linked_worktree (git_common_dir, d->d_name))) {ALLOC_GROW (list, counter +1 , alloc); list[counter++] = linked; }
@@ -209,6 +210,25 @@ struct worktree **get_worktrees(void)return list; } +struct worktree **get_worktrees (void ) +{ +return get_worktrees_internal (get_git_common_dir ()); +} + +struct worktree **get_submodule_worktrees (const char *path) +{ +const char *submodule_common_dir; +struct strbuf sb =STRBUF_INIT ; +struct worktree **ret; +strbuf_addf (&sb,"%s/.git" , path); + submodule_common_dir =resolve_gitdir (sb.buf); + + ret =get_worktrees_internal (submodule_common_dir); + +strbuf_release (&sb); +return ret; +} +const char *get_worktree_git_dir (const struct worktree *wt) {if (!wt)
worktree.h +5 -0
@@ -25,6 +25,11 @@ struct worktree {*/ extern struct worktree **get_worktrees (void ); +/* +* Get the worktrees of a submodule named by `path`. +*/ +extern struct worktree **get_submodule_worktrees (const char *path); +/* * Return git dir of the worktree. Note that the path may be relative. * If wt is NULL, git dir of current worktree is returned.
Signature · 1 line
2.10.2.613.g22f2156
PATCH v3 1/5 submodule: use absolute path for computing relative path connecting
The current caller of connect_work_tree_and_git_dir passes
an absolute path for the git_dir parameter. In the future patch we will also pass in relative path for git_dir. Extend the functionality of connect_work_tree_and_git_dir to take relative paths for parameters.
We could work around this in the future patch by computing the absolute path for the git_dir in the calling site, however accepting relative paths for either parameter makes the API for this function much harder to misuse.
--- submodule.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
submodule.c +7 -5
@@ -1227,23 +1227,25 @@ void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir) {struct strbuf file_name =STRBUF_INIT ;struct strbuf rel_path =STRBUF_INIT ; -const char *real_work_tree =xstrdup (real_path (work_tree)); +char *real_git_dir =xstrdup (real_path (git_dir)); +char *real_work_tree =xstrdup (real_path (work_tree));/* Update gitfile */ strbuf_addf (&file_name,"%s/.git" , work_tree);write_file (file_name.buf,"gitdir: %s" , -relative_path (git_dir, real_work_tree, &rel_path)); +relative_path (real_git_dir, real_work_tree, &rel_path));/* Update core.worktree setting */ strbuf_reset (&file_name); -strbuf_addf (&file_name,"%s/config" , git_dir); +strbuf_addf (&file_name,"%s/config" , real_git_dir);git_config_set_in_file (file_name.buf,"core.worktree" , -relative_path (real_work_tree, git_dir, +relative_path (real_work_tree, real_git_dir, &rel_path));strbuf_release (&file_name);strbuf_release (&rel_path); -free ((void *)real_work_tree); +free (real_work_tree); +free (real_git_dir); }int parallel_submodules (void )
Signature · 1 line
2.10.2.613.g22f2156
PATCH v3 2/5 submodule helper: support super prefix
In reply to Stefan BellerJust like main commands in Git, the submodule helper needs access to the superproject prefix. Enable this in the git.c but have its own fuse in the helper code by having a flag to turn on the super prefix.
--- builtin/submodule--helper.c | 31 ++++++++++++++++++++----------- git.c | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-)
builtin/submodule--helper.c +20 -11
@@ -1076,21 +1076,24 @@ static int resolve_remote_submodule_branch(int argc, const char **argv,return 0 ; } +#define SUPPORT_SUPER_PREFIX (1<<0) +struct cmd_struct {const char *cmd;int (*fn)(int ,const char **,const char *); +int option; };static struct cmd_struct commands[] = { - {"list" , module_list}, - {"name" , module_name}, - {"clone" , module_clone}, - {"update-clone" , update_clone}, - {"relative-path" , resolve_relative_path}, - {"resolve-relative-url" , resolve_relative_url}, - {"resolve-relative-url-test" , resolve_relative_url_test}, - {"init" , module_init}, - {"remote-branch" , resolve_remote_submodule_branch} + {"list" , module_list,0 }, + {"name" , module_name,0 }, + {"clone" , module_clone,0 }, + {"update-clone" , update_clone,0 }, + {"relative-path" , resolve_relative_path,0 }, + {"resolve-relative-url" , resolve_relative_url,0 }, + {"resolve-relative-url-test" , resolve_relative_url_test,0 }, + {"init" , module_init,0 }, + {"remote-branch" , resolve_remote_submodule_branch,0 } };int cmd_submodule__helper (int argc,const char **argv,const char *prefix)
@@ -1100,9 +1103,15 @@ int cmd_submodule__helper(int argc, const char **argv, const char *prefix)die (_ ("submodule--helper subcommand must be " "called with a subcommand" )); -for (i =0 ; i <ARRAY_SIZE (commands); i++) -if (!strcmp (argv[1 ], commands[i].cmd)) +for (i =0 ; i <ARRAY_SIZE (commands); i++) { +if (!strcmp (argv[1 ], commands[i].cmd)) { +if (get_super_prefix () && + !(commands[i].option &SUPPORT_SUPER_PREFIX )) +die ("%s doesn't support --super-prefix" , + commands[i].cmd);return commands[i].fn (argc -1 , argv +1 , prefix); + } + }die (_ ("'%s' is not a valid submodule--helper " "subcommand" ), argv[1 ]);
git.c +1 -1
@@ -493,7 +493,7 @@ static struct cmd_struct commands[] = { { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE }, { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE }, { "stripspace", cmd_stripspace }, - { "submodule--helper", cmd_submodule__helper, RUN_SETUP }, + { "submodule--helper", cmd_submodule__helper, RUN_SETUP | SUPPORT_SUPER_PREFIX}, { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP }, { "tag", cmd_tag, RUN_SETUP }, { "unpack-file", cmd_unpack_file, RUN_SETUP },
Signature · 1 line
2.10.2.613.g22f2156
PATCH v3 3/5 test-lib-functions.sh: teach test_commit -C <dir>
In reply to Stefan BellerSpecifically when setting up submodule tests, it comes in handy if we can create commits in repositories that are not at the root of the tested trash dir. Add "-C <dir>" similar to gits -C parameter that will perform the operation in the given directory.
--- t/test-lib-functions.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
t/test-lib-functions.sh +15 -5
@@ -157,16 +157,21 @@ debug () { GIT_TEST_GDB=1 "$@" } -# Call test_commit with the arguments "<message> [<file> [<contents> [<tag>]]]" +# Call test_commit with the arguments +# [-C <directory>] <message> [<file> [<contents> [<tag>]]]" # # This will commit a file with the given contents and the given commit # message, and tag the resulting commit with the given tag name. # # <file>, <contents>, and <tag> all default to <message>. +# +# If the first argument is "-C", the second argument is used as a path for +# the git invocations. test_commit () { notick= && signoff= && + indir= && while test $# != 0 do case "$1" in
@@ -176,21 +181,26 @@ test_commit () { --signoff) signoff="$1" ;; + -C) + indir="$2" + shift + ;; *) break ;; esac shift done && + indir=${indir:+"$indir"/} && file=${2:-"$1.t"} && - echo "${3-$1}" > "$file" && - git add "$file" && + echo "${3-$1}" > "$indir$file" && + git ${indir:+ -C "$indir"} add "$file" && if test -z "$notick" then test_tick fi && - git commit $signoff -m "$1" && - git tag "${4:-$1}" + git ${indir:+ -C "$indir"} commit $signoff -m "$1" && + git ${indir:+ -C "$indir"} tag "${4:-$1}" } # Call test_merge with the arguments "<message> <commit>", where <commit>
Signature · 1 line
2.10.2.613.g22f2156
PATCH v3 4/5 worktree: get worktrees from submodules
In reply to Stefan BellerIn a later patch we want to move around the the git directory of a submodule. Both submodules as well as worktrees are involved in placing git directories at unusual places, so their functionality may collide. To react appropriately to situations where worktrees in submodules are in use, offer a new function to query the worktrees for submodules.
--- worktree.c | 40 ++++++++++++++++++++++++++++++---------- worktree.h | 5 +++++ 2 files changed, 35 insertions(+), 10 deletions(-)
worktree.c +30 -10
@@ -72,7 +72,7 @@ static void add_head_info(struct strbuf *head_ref, struct worktree *worktree)/** * get the main worktree */ -static struct worktree *get_main_worktree (void ) +static struct worktree *get_main_worktree (const char *git_common_dir) {struct worktree *worktree =NULL ;struct strbuf path =STRBUF_INIT ;
@@ -81,12 +81,12 @@ static struct worktree *get_main_worktree(void)int is_bare =0 ;int is_detached =0 ; -strbuf_add_absolute_path (&worktree_path,get_git_common_dir ()); +strbuf_add_absolute_path (&worktree_path, git_common_dir); is_bare = !strbuf_strip_suffix (&worktree_path,"/.git" );if (is_bare)strbuf_strip_suffix (&worktree_path,"/." ); -strbuf_addf (&path,"%s/HEAD" ,get_git_common_dir ()); +strbuf_addf (&path,"%s/HEAD" , git_common_dir);if (parse_ref (path.buf, &head_ref, &is_detached) <0 ) goto done;
@@ -109,7 +109,8 @@ static struct worktree *get_main_worktree(void)return worktree; } -static struct worktree *get_linked_worktree (const char *id) +static struct worktree *get_linked_worktree (const char *git_common_dir, +const char *id) {struct worktree *worktree =NULL ;struct strbuf path =STRBUF_INIT ;
@@ -120,7 +121,7 @@ static struct worktree *get_linked_worktree(const char *id)if (!id)die ("Missing linked worktree name" ); -strbuf_git_common_path (&path,"worktrees/%s/gitdir" , id); +strbuf_addf (&path,"%s/worktrees/%s/gitdir" , git_common_dir, id);if (strbuf_read_file (&worktree_path, path.buf,0 ) <=0 )/* invalid gitdir file */ goto done;
@@ -133,7 +134,7 @@ static struct worktree *get_linked_worktree(const char *id) }strbuf_reset (&path); -strbuf_addf (&path,"%s/worktrees/%s/HEAD" ,get_git_common_dir (), id); +strbuf_addf (&path,"%s/worktrees/%s/HEAD" , git_common_dir, id);if (parse_ref (path.buf, &head_ref, &is_detached) <0 ) goto done;
@@ -173,7 +174,7 @@ static void mark_current_worktree(struct worktree **worktrees)free (git_dir); } -struct worktree **get_worktrees (void ) +struct worktree **get_worktrees_internal (const char *git_common_dir) {struct worktree **list =NULL ;struct strbuf path =STRBUF_INIT ;
@@ -183,10 +184,10 @@ struct worktree **get_worktrees(void) list =xmalloc (alloc *sizeof (struct worktree *)); -if ((list[counter] =get_main_worktree ())) +if ((list[counter] =get_main_worktree (git_common_dir))) counter++; -strbuf_addf (&path,"%s/worktrees" ,get_git_common_dir ()); +strbuf_addf (&path,"%s/worktrees" , git_common_dir); dir =opendir (path.buf);strbuf_release (&path);if (dir) {
@@ -195,7 +196,7 @@ struct worktree **get_worktrees(void)if (is_dot_or_dotdot (d->d_name))continue ; -if ((linked =get_linked_worktree (d->d_name))) { +if ((linked =get_linked_worktree (git_common_dir, d->d_name))) {ALLOC_GROW (list, counter +1 , alloc); list[counter++] = linked; }
@@ -209,6 +210,25 @@ struct worktree **get_worktrees(void)return list; } +struct worktree **get_worktrees (void ) +{ +return get_worktrees_internal (get_git_common_dir ()); +} + +struct worktree **get_submodule_worktrees (const char *path) +{ +const char *submodule_common_dir; +struct strbuf sb =STRBUF_INIT ; +struct worktree **ret; +strbuf_addf (&sb,"%s/.git" , path); + submodule_common_dir =resolve_gitdir (sb.buf); + + ret =get_worktrees_internal (submodule_common_dir); + +strbuf_release (&sb); +return ret; +} +const char *get_worktree_git_dir (const struct worktree *wt) {if (!wt)
worktree.h +5 -0
@@ -25,6 +25,11 @@ struct worktree {*/ extern struct worktree **get_worktrees (void ); +/* +* Get the worktrees of a submodule named by `path`. +*/ +extern struct worktree **get_submodule_worktrees (const char *path); +/* * Return git dir of the worktree. Note that the path may be relative. * If wt is NULL, git dir of current worktree is returned.
Signature · 1 line
2.10.2.613.g22f2156
PATCH v3 5/5 submodule: add embed-git-dir function
In reply to Stefan BellerWhen a submodule has its git dir inside the working dir, the submodule support for checkout that we plan to add in a later patch will fail.
Add functionality to migrate the git directory to be embedded into the superprojects git directory.
--- Documentation/git-submodule.txt | 14 ++++++ builtin/submodule--helper.c | 39 ++++++++++++++++- dir.c | 78 +++++++++++++++++++++++++++++++++ dir.h | 4 ++ git-submodule.sh | 7 ++- submodule.h | 1 - t/t7412-submodule-embedgitdirs.sh | 92 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 232 insertions(+), 3 deletions(-) create mode 100755 t/t7412-submodule-embedgitdirs.sh
Documentation/git-submodule.txt +14 -0
@@ -22,6 +22,7 @@ SYNOPSIS [commit] [--] [<path>...] 'git submodule' [--quiet] foreach [--recursive] <command> 'git submodule' [--quiet] sync [--recursive] [--] [<path>...] +'git submodule' [--quiet] embedgitdirs [--] [<path>...] DESCRIPTION
@@ -245,6 +246,19 @@ sync:: If `--recursive` is specified, this command will recurse into the registered submodules, and sync any nested submodules within. +embedgitdirs:: + Move the git directory of submodules into its superprojects + `$GIT_DIR/modules` path and then connect the git directory and + its working directory by setting the `core.worktree` and adding + a .git file pointing to the git directory interned into the + superproject. ++ +A repository that was cloned independently and later added as a submodule or +old setups have the submodules git directory inside the submodule instead of +embedded into the superprojects git directory. ++ +This command is recursive by default. + OPTIONS ------- -q::
builtin/submodule--helper.c +38 -1
@@ -1076,6 +1076,42 @@ static int resolve_remote_submodule_branch(int argc, const char **argv,return 0 ; } +static int embed_git_dir (int argc,const char **argv,const char *prefix) +{ +int i; +struct pathspec pathspec; +struct module_list list =MODULE_LIST_INIT ; +unsigned flags =RELOCATE_GITDIR_RECURSE_SUBMODULES ; + +struct option embed_gitdir_options[] = { +OPT_STRING (0 ,"prefix" , &prefix, +N_ ("path" ), +N_ ("path into the working tree" )), +OPT_BIT (0 ,"--recursive" , &flags,N_ ("recurse into submodules" ), +RELOCATE_GITDIR_RECURSE_SUBMODULES ), +OPT_END () + }; + +const char *const git_submodule_helper_usage[] = { +N_ ("git submodule--helper embed-git-dir [<path>...]" ), +NULL + }; + + argc =parse_options (argc, argv, prefix, embed_gitdir_options, + git_submodule_helper_usage,0 ); + +gitmodules_config (); +git_config (submodule_config,NULL ); + +if (module_list_compute (argc, argv, prefix, &pathspec, &list) <0 ) +return 1 ; + +for (i =0 ; i < list.nr; i++) +relocate_gitdir (prefix, list.entries[i]->name, flags); + +return 0 ; +} +#define SUPPORT_SUPER_PREFIX (1<<0)struct cmd_struct {
@@ -1093,7 +1129,8 @@ static struct cmd_struct commands[] = { {"resolve-relative-url", resolve_relative_url, 0}, {"resolve-relative-url-test", resolve_relative_url_test, 0}, {"init", module_init, 0}, - {"remote-branch", resolve_remote_submodule_branch, 0} + {"remote-branch", resolve_remote_submodule_branch, 0}, + {"embed-git-dirs", embed_git_dir, SUPPORT_SUPER_PREFIX} };int cmd_submodule__helper (int argc,const char **argv,const char *prefix)
dir.c +78 -0
87 lines not on this page · raw message
dir.h +4 -0
@@ -335,4 +335,8 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned longvoid write_untracked_extension (struct strbuf *out,struct untracked_cache *untracked);void add_untracked_cache (struct index_state *istate);void remove_untracked_cache (struct index_state *istate); + +#define RELOCATE_GITDIR_RECURSE_SUBMODULES (1<<0) +extern void relocate_gitdir (const char *prefix,const char *path,unsigned flags); +#endif
git-submodule.sh +6 -1
@@ -1131,6 +1131,11 @@ cmd_sync() done } +cmd_embedgitdirs() +{ + git submodule--helper embed-git-dirs --prefix "$wt_prefix" "$@" +} + # This loop parses the command line arguments to find the # subcommand name to dispatch. Parsing of the subcommand specific # options are primarily done by the subcommand implementations.
@@ -1140,7 +1145,7 @@ cmd_sync() while test $# != 0 && test -z "$command" do case "$1" in - add | foreach | init | deinit | update | status | summary | sync) + add | foreach | init | deinit | update | status | summary | sync | embedgitdirs) command=$1 ;; -q|--quiet)
submodule.h +0 -1
@@ -74,5 +74,4 @@ int parallel_submodules(void);* retaining any config in the environment. */ void prepare_submodule_repo_env (struct argv_array *out); -#endif
t/t7412-submodule-embedgitdirs.sh new file +92 -0
92 lines not on this page · raw message
Signature · 1 line
2.10.2.613.g22f2156