submodule: support worktree-specific configuration
cover submodule: support worktree-specific configuration
When extensions.worktreeConfig is enabled, this series stores submodule settings that can differ between worktrees in the worktree config.
The changes include:
* [1/3] Keep submodule.<name>.gitdir relative for linked worktrees.
* [2/3] Store submodule settings in the worktree config when extensions.worktreeConfig is enabled.
* [3/3] Make git submodule init copy an existing gitdir setting to the current worktree config only when it belongs to that worktree.
Yoichi NAKAYAMA (3):
submodule: make submodule.<name>.gitdir relative for worktrees
submodule: store settings in worktree config when enabled submodule init: copy submodule.<name>.gitdir to config.worktree
Documentation/config/submodule.adoc | 3 +- builtin/submodule--helper.c | 197 +++++++++++++++------ builtin/worktree.c | 23 +++ t/t2405-worktree-submodule.sh | 129 ++++++++++++++ t/t7425-submodule-gitdir-path-extension.sh | 131 ++++++++++++++ 5 files changed, 431 insertions(+), 52 deletions(-)
base-commit: fbd2d1e765da4d2931cadc4c62d3ca5d5b590e7e
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2306%2Fyoichi%2Fsubmodule-with-worktree-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2306/yoichi/submodule-with-worktree-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2306
Signature · 1 line
gitgitgadget
PATCH 1/3 submodule: make submodule.<name>.gitdir relative for worktrees
From: Yoichi NAKAYAMA <[email protected]>
For a linked worktree, always keep submodule.<name>.gitdir relative to ensure it continues to work when the worktree is moved along with the main worktree. (This benefit also requires worktree.useRelativePaths to be set to true.)
--- builtin/submodule--helper.c | 68 +++++++++++++--------- t/t7425-submodule-gitdir-path-extension.sh | 19 ++++++ 2 files changed, 61 insertions(+), 26 deletions(-)
builtin/submodule--helper.c +42 -26
@@ -37,6 +37,7 @@#include "wildmatch.h" #include "strbuf.h" #include "url.h" +#include "worktree.h" #define OPT_QUIET (1 << 0)#define OPT_CACHED (1 << 1)
@@ -507,50 +508,60 @@ static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path,static void create_default_gitdir_config (const char *submodule_name) { +struct worktree *wt =get_current_worktree (the_repository); +const char *modules_dir; +struct strbuf tmp =STRBUF_INIT ;struct strbuf gitdir_path =STRBUF_INIT ;struct git_hash_ctx ctx;char hex_name_hash[GIT_MAX_HEXSZ +1 ], header[128 ];unsigned char raw_name_hash[GIT_MAX_RAWSZ ];int header_len; -/* Case 1: try the plain module name */ -repo_git_path_append (the_repository, &gitdir_path,"modules/%s" , submodule_name); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) { -strbuf_release (&gitdir_path); -return ; + modules_dir =worktree_git_path (wt,"modules/" ); +if (is_absolute_path (modules_dir)) { + modules_dir =relative_path (modules_dir, wt->path, &tmp); } +/* Case 1: try the plain module name */ +strbuf_addstr (&gitdir_path, modules_dir); +strbuf_addstr (&gitdir_path, submodule_name); +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup; +/* Case 2.1: Try URI-safe (RFC3986) encoding first, this fixes nested gitdirs */ strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/" ); +strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_rfc3986_unreserved); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) { -strbuf_release (&gitdir_path); -return ; - } +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup;/* Case 2.2: Try extended uppercase URI (RFC3986) encoding, to fix case-folding */ strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/" ); +strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_casefolding_rfc3986_unreserved); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) -return ; +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup;/* Case 2.3: Try some derived gitdir names, see if one sticks */ for (char c ='0' ; c <='9' ; c++) {strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/" ); +strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_rfc3986_unreserved);strbuf_addch (&gitdir_path, c); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) -return ; +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup;strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/" ); +strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_casefolding_rfc3986_unreserved);strbuf_addch (&gitdir_path, c); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) -return ; +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup; }/* Case 2.4: If all the above failed, try a hash of the name as a last resort */
@@ -563,17 +574,22 @@ static void create_default_gitdir_config(const char *submodule_name)git_hash_final (raw_name_hash, &ctx);hash_to_hex_algop_r (hex_name_hash, raw_name_hash, the_hash_algo);strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/%s" , hex_name_hash); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) { -strbuf_release (&gitdir_path); -return ; - } +strbuf_addstr (&gitdir_path, modules_dir); +strbuf_addstr (&gitdir_path, hex_name_hash); +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup;/* Case 3: nothing worked, error out */ die (_ ("failed to set a valid default config for 'submodule.%s.gitdir'. " "Please ensure it is set, for example by running something like: " -"'git config submodule.%s.gitdir .git/modules/%s'" ), - submodule_name, submodule_name, submodule_name); +"'git config submodule.%s.gitdir %s%s'" ), + submodule_name, submodule_name, modules_dir, submodule_name); + +cleanup: +strbuf_release (&gitdir_path); +strbuf_release (&tmp); +free_worktree (wt); } static void init_submodule(const char *path, const char *prefix,
t/t7425-submodule-gitdir-path-extension.sh +19 -0
@@ -279,6 +279,25 @@ test_expect_success '`git clone --recurse-submodules` respects init.defaultSubmo ) ' +test_expect_success 'git submodule init make gitdir relative' ' + test_when_finished "rm -rf repo-clone-init-wt" && + git clone upstream repo-clone-init-wt && + ( + cd repo-clone-init-wt && + git config core.repositoryformatversion 1 && + git config extensions.submodulePathConfig true && + git worktree add wt && + cd wt && + git submodule init && + git config submodule.sub1.gitdir >actual && + echo "../.git/worktrees/wt/modules/sub1" >expect && + test_cmp expect actual && + git config submodule.sub2.gitdir >actual && + echo "../.git/worktrees/wt/modules/sub2" >expect && + test_cmp expect actual + ) +' + test_expect_success 'submodule--helper migrates legacy modules' ' ( cd upstream &&
Signature · 1 line
gitgitgadget
Re: [PATCH 1/3] submodule: make submodule.<name>.gitdir relative for worktrees
Quoted 38 lines · Yoichi NAKAYAMA via GitGitGadget
From: Yoichi NAKAYAMA <[email protected]>
For a linked worktree, always keep
submodule.<name>.gitdirrelative to ensure it continues to work when the worktree is moved along with the main worktree. (This benefit also requires worktree.useRelativePaths to be set to true.)Signed-off-by Yoichi NAKAYAMA <[email protected]>--- builtin/submodule--helper.c | 68 +++++++++++++--------- t/t7425-submodule-gitdir-path-extension.sh | 19 ++++++ 2 files changed, 61 insertions(+), 26 deletions(-)builtin/submodule--helper.c +4
-0@@ -37,6 +37,7 @@#include "wildmatch.h" #include "strbuf.h" #include "url.h" +#include "worktree.h" #define OPT_QUIET (1 << 0)#define OPT_CACHED (1 << 1)@@ -507,50 +508,60 @@ static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path,static void create_default_gitdir_config (const char *submodule_name) { +struct worktree *wt =get_current_worktree (the_repository); +const char *modules_dir; +struct strbuf tmp =STRBUF_INIT ;struct strbuf gitdir_path =STRBUF_INIT ;struct git_hash_ctx ctx;char hex_name_hash[GIT_MAX_HEXSZ +1 ], header[128 ];unsigned char raw_name_hash[GIT_MAX_RAWSZ ];int header_len;
builtin/submodule--helper.c static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path, · line 523
Quoted 10 lines
builtin/submodule--helper.c +3
-5-/* Case 1: try the plain module name */ -repo_git_path_append (the_repository, &gitdir_path,"modules/%s" , submodule_name); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) { -strbuf_release (&gitdir_path); -return ; + modules_dir =worktree_git_path (wt,"modules/" ); +if (is_absolute_path (modules_dir)) { + modules_dir =relative_path (modules_dir, wt->path, &tmp); }
I noticed that worktree_git_path() returns a pointer to a static buffer managed by get_pathname(). I'll copy the result into tmp immediately, before calling other functions that might overwrite the buffer:
modules_dir = worktree_git_path(wt, "modules/");
if (is_absolute_path(modules_dir))
relative_path(modules_dir, wt->path, &tmp);
else
strbuf_addstr(&tmp, modules_dir);
modules_dir = tmp.buf;Thanks,
Signature · 1 line
Yoichi NAKAYAMA
Re: [PATCH 1/3] submodule: make submodule.<name>.gitdir relative for worktrees
Quoted 56 lines · Yoichi NAKAYAMA
Quoted 38 lines · Yoichi NAKAYAMA via GitGitGadget
From: Yoichi NAKAYAMA <[email protected]>
For a linked worktree, always keep
submodule.<name>.gitdirrelative to ensure it continues to work when the worktree is moved along with the main worktree. (This benefit also requires worktree.useRelativePaths to be set to true.)Signed-off-by Yoichi NAKAYAMA <[email protected]>--- builtin/submodule--helper.c | 68 +++++++++++++--------- t/t7425-submodule-gitdir-path-extension.sh | 19 ++++++ 2 files changed, 61 insertions(+), 26 deletions(-)builtin/submodule--helper.c +4
-0@@ -37,6 +37,7 @@#include "wildmatch.h" #include "strbuf.h" #include "url.h" +#include "worktree.h" #define OPT_QUIET (1 << 0)#define OPT_CACHED (1 << 1)@@ -507,50 +508,60 @@ static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path,static void create_default_gitdir_config (const char *submodule_name) { +struct worktree *wt =get_current_worktree (the_repository); +const char *modules_dir; +struct strbuf tmp =STRBUF_INIT ;struct strbuf gitdir_path =STRBUF_INIT ;struct git_hash_ctx ctx;char hex_name_hash[GIT_MAX_HEXSZ +1 ], header[128 ];unsigned char raw_name_hash[GIT_MAX_RAWSZ ];int header_len;builtin/submodule--helper.c static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path, · line 523
Quoted 10 lines
builtin/submodule--helper.c +3
-5-/* Case 1: try the plain module name */ -repo_git_path_append (the_repository, &gitdir_path,"modules/%s" , submodule_name); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) { -strbuf_release (&gitdir_path); -return ; + modules_dir =worktree_git_path (wt,"modules/" ); +if (is_absolute_path (modules_dir)) { + modules_dir =relative_path (modules_dir, wt->path, &tmp); }I noticed that
worktree_git_path()returns a pointer to a static buffer managed byget_pathname(). I'll copy the result into tmp immediately, before calling other functions that might overwrite the buffer:
Quoted 6 lines
modules_dir = worktree_git_path(wt, "modules/");
if (is_absolute_path(modules_dir))
relative_path(modules_dir, wt->path, &tmp);
else
strbuf_addstr(&tmp, modules_dir);
modules_dir = tmp.buf;Correction: relative_path() does not always store the result in tmp. The code should be:
modules_dir = worktree_git_path(wt, "modules/");
if (is_absolute_path(modules_dir)) {
modules_dir = relative_path(modules_dir, wt->path, &tmp);
} else {
strbuf_addstr(&tmp, modules_dir);
modules_dir = tmp.buf;
}Thanks,
Signature · 1 line
Yoichi NAKAYAMA
PATCH 2/3 submodule: store settings in worktree config when enabled
In reply to Yoichi NAKAYAMA via GitGitGadgetFrom: Yoichi NAKAYAMA <[email protected]>
Submodule URLs can differ between branches. For example, one branch may use the upstream repository while another uses a fork for the same submodule. When these branches are checked out in separate worktrees, storing submodule.<name>.url in the shared repository config prevents each worktree from using its own URL.
Store submodule settings such as submodule.<name>.active and submodule.<name>.url in the worktree config when extensions.worktreeConfig is enabled.
Settings shared between worktrees can remain in the repository config. When such a setting exists there, 'git submodule deinit' sets submodule.<name>.active to false in the worktree config to unregister the submodule.
Unlike other settings, submodule.<name>.gitdir should not be shared between worktrees, so exclude it from the config copied by 'git worktree add'.
--- Documentation/config/submodule.adoc | 3 +- builtin/submodule--helper.c | 43 ++++--- builtin/worktree.c | 23 ++++ t/t2405-worktree-submodule.sh | 129 +++++++++++++++++++++ t/t7425-submodule-gitdir-path-extension.sh | 49 ++++++++ 5 files changed, 227 insertions(+), 20 deletions(-)
Documentation/config/submodule.adoc +2 -1
@@ -58,7 +58,8 @@ submodule.<name>.gitdir:: respected when `extensions.submodulePathConfig` is enabled, otherwise it has no effect. When enabled, this config becomes the single source of truth for submodule gitdir paths and Git will error if it is missing. - See linkgit:git-config[1] for details. + When `extensions.worktreeConfig` is enabled, this setting is stored in + each worktree's config. See linkgit:git-config[1] for details. submodule.active:: A repeated field which contains a pathspec used to match against a
builtin/submodule--helper.c +24 -19
115 lines not on this page · raw message
builtin/worktree.c +23 -0
@@ -363,6 +363,9 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)if (file_exists (from_file)) {struct config_set cs = { {0 } };int bare; +struct string_list keys =STRING_LIST_INIT_DUP ; +struct string_list_item *item; +int i;if (safe_create_leading_directories (the_repository, to_file) ||copy_file (the_repository, to_file, from_file,0666 )) {
@@ -386,6 +389,26 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)error (_ ("failed to unset '%s' in '%s'" ),"core.worktree" , to_file); +/* unset "submodule.*.gitdir" */ +for (i =0 ; i < cs.list.nr; i++) { +const char *var = cs.list.items[i].e->key; +const char *subsection, *key; +size_t subsection_len; + +if (!parse_config_key (var,"submodule" , + &subsection, &subsection_len, &key) && + subsection && !strcmp (key,"gitdir" )) +string_list_insert (&keys, var); + } +for_each_string_list_item (item, &keys) { +if (repo_config_set_in_file_gently (the_repository, + to_file, item->string, +NULL ,NULL )) +error (_ ("failed to unset '%s' in '%s'" ), + item->string, to_file); + } +string_list_clear (&keys,0 ); +git_configset_clear (&cs); }
t/t2405-worktree-submodule.sh +129 -0
133 lines not on this page · raw message
t/t7425-submodule-gitdir-path-extension.sh +49 -0
55 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH 3/3 submodule init: copy submodule.<name>.gitdir to config.worktree
In reply to Yoichi NAKAYAMA via GitGitGadgetFrom: Yoichi NAKAYAMA <[email protected]>
If a repository already has gitdir settings in its repository config when extensions.worktreeConfig is enabled, those settings belong to a particular worktree. Make 'git submodule init' copy an existing setting to the worktree config if it belongs to the current worktree; otherwise, generate a new setting.
--- builtin/submodule--helper.c | 100 ++++++++++++++++++--- t/t7425-submodule-gitdir-path-extension.sh | 65 +++++++++++++- 2 files changed, 151 insertions(+), 14 deletions(-)
builtin/submodule--helper.c +87 -13
@@ -480,10 +480,41 @@ struct init_cb { };#define INIT_CB_INIT { 0 } +static int validate_submodule_git_dir_with_worktree (const char *gitdir) +{ +struct strbuf tmp =STRBUF_INIT ; +struct strbuf submodule =STRBUF_INIT ; +char *super; +int ret =1 ; + +if (is_absolute_path (gitdir)) +strbuf_addstr (&submodule, gitdir); +else if (!repo_worktree_path_append (the_repository, &submodule, +"%s" , gitdir)) +return -1 ; + +if (strbuf_normalize_path (&submodule)) { +strbuf_release (&submodule); +return -1 ; + } + + super =absolute_pathdup (repo_get_git_dir (the_repository)); + +if (starts_with (relative_path (submodule.buf, super, &tmp),"modules/" )) + ret =0 ; + +strbuf_release (&submodule); +strbuf_release (&tmp); +free (super); +return ret; +} +static int validate_and_set_submodule_gitdir (struct strbuf *gitdir_path, -const char *submodule_name) +const char *submodule_name, +struct worktree *wt) { -const char *value; +const char *value = gitdir_path->buf; +char *value_to_free =NULL ;char *key;if (validate_submodule_git_dir (gitdir_path->buf, submodule_name))
@@ -491,18 +522,55 @@ static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path, key =xstrfmt ("submodule.%s.gitdir" , submodule_name); -/* Nothing to do if the config already exists. */ -if (!repo_config_get_string_tmp (the_repository, key, &value)) { -free (key); -return 0 ; +if (the_repository->repository_format_worktree_config) { +struct config_set cs = {0 }; +const char *filename =worktree_git_path (wt,"config.worktree" ); +char *tmp; + +git_configset_init (&cs); +git_configset_add_file (&cs, filename); + +/* +* Nothing to do if the config already exists in the config set +* for the current worktree. +*/ +if (!git_configset_get (&cs, key)) { +git_configset_clear (&cs); +free (key); +return 0 ; + } + +git_configset_clear (&cs); + +/* +* If the worktree config does not have this key, check the +* effective value from lower-priority config scopes and copy +* it to the worktree config if it belongs to the current +* worktree. +*/ +if (!repo_config_get_string (the_repository, key, &tmp)) { +if (validate_submodule_git_dir_with_worktree (tmp) || +validate_submodule_git_dir (tmp, submodule_name)) +free (tmp); +else + value = value_to_free = tmp; + } + }else { +/* Nothing to do if the config already exists. */ +if (!repo_config_get_string_tmp (the_repository, key, &value)) { +free (key); +return 0 ; + } } -if (repo_config_set_worktree_gently (the_repository, key, gitdir_path->buf)) { +if (repo_config_set_worktree_gently (the_repository, key, value)) {free (key); +free (value_to_free);return -1 ; }free (key); +free (value_to_free);return 0 ; }
@@ -526,7 +594,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr (&gitdir_path, submodule_name);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;/* Case 2.1: Try URI-safe (RFC3986) encoding first, this fixes nested gitdirs */
@@ -534,7 +603,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_rfc3986_unreserved);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;/* Case 2.2: Try extended uppercase URI (RFC3986) encoding, to fix case-folding */
@@ -542,7 +612,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_casefolding_rfc3986_unreserved);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;/* Case 2.3: Try some derived gitdir names, see if one sticks */
@@ -552,7 +623,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_rfc3986_unreserved);strbuf_addch (&gitdir_path, c);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;strbuf_reset (&gitdir_path);
@@ -560,7 +632,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_casefolding_rfc3986_unreserved);strbuf_addch (&gitdir_path, c);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup; }
@@ -577,7 +650,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr (&gitdir_path, hex_name_hash);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;/* Case 3: nothing worked, error out */
t/t7425-submodule-gitdir-path-extension.sh +64 -1
77 lines not on this page · raw message
Signature · 1 line
gitgitgadget
v2 cover submodule: support worktree-specific configuration
In reply to Yoichi NAKAYAMA via GitGitGadgetWhen using multiple worktrees, submodule settings stored in the repository config are shared between all worktrees, even when they need to differ.
For example, different branches may use different URLs for the same submodule. More importantly, sharing submodule.<name>.gitdir causes submodule worktrees to share the same HEAD and index, even when the corresponding superproject worktrees record different commits for the submodule.
This series makes submodule settings worktree-specific when extensions.worktreeConfig is enabled. It also keeps submodule.<name>.gitdir relative for linked worktrees, so it continues to work when the worktree is moved along with the main worktree.
The changes include:
* [1/3] Keep submodule.<name>.gitdir relative for linked worktrees.
* [2/3] Store submodule settings in the worktree config when extensions.worktreeConfig is enabled.
* [3/3] Make git submodule init copy an existing gitdir setting to the current worktree config only when it belongs to that worktree.
Changes in v2
=============
* Update the cover letter to better explain the problems this series addresses.
* [1/3] Copy the string returned by worktree_git_path() early.
* [2/3] Expand the explanation in the commit message for why the gitdir config is excluded from worktree add.
* [3/3] Explain the case where the repository config contains a gitdir setting for another worktree, and warn when the setting is not copied.
Yoichi NAKAYAMA (3):
submodule: make submodule.<name>.gitdir relative for worktrees
submodule: store settings in worktree config when enabled submodule init: copy submodule.<name>.gitdir to config.worktree
Documentation/config/submodule.adoc | 3 +- builtin/submodule--helper.c | 213 ++++++++++++++++----- builtin/worktree.c | 23 +++ t/t2405-worktree-submodule.sh | 129 +++++++++++++ t/t7425-submodule-gitdir-path-extension.sh | 135 +++++++++++++ 5 files changed, 451 insertions(+), 52 deletions(-)
base-commit: f7de81456940dd6f3274e461149bba12965de609
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2306%2Fyoichi%2Fsubmodule-with-worktree-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2306/yoichi/submodule-with-worktree-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2306
Range-diff vs v1:
1: f9adc6c85c ! 1: 435ca42ec9 submodule: make submodule.<name>.gitdir relative for worktrees
@@ builtin/submodule--helper.c: static int validate_and_set_submodule_gitdir(struct
+ modules_dir = worktree_git_path(wt, "modules/");
+ if (is_absolute_path(modules_dir)) {
+ modules_dir = relative_path(modules_dir, wt->path, &tmp);
++ } else {
++ strbuf_addstr(&tmp, modules_dir);
++ modules_dir = tmp.buf;
}
+ /* Case 1: try the plain module name */ 2: 14b156bc42 ! 2: e816484923 submodule: store settings in worktree config when enabled
@@ Commit message
submodule.<name>.active to false in the worktree config to unregister the submodule.
- Unlike other settings, submodule.<name>.gitdir should not be shared
- between worktrees, so exclude it from the config copied by 'git
+ Unlike other settings, submodule.<name>.gitdir must not be shared
+ between worktrees. Different commits in the superproject may record
+ different commits for the same submodule. If the gitdir is shared, the
+ submodule worktrees end up sharing the same HEAD and index, causing
+ Git commands to behave incorrectly. Therefore, store this setting in
+ the worktree config and exclude it from the config copied by 'git
worktree add'.
3: cdf089b635 ! 3: b5d203d014 submodule init: copy submodule.<name>.gitdir to config.worktree
@@ Metadata
## Commit message ##
submodule init: copy submodule.<name>.gitdir to config.worktree
- If a repository already has gitdir settings in its repository config
- when extensions.worktreeConfig is enabled, those settings belong to a
- particular worktree. Make 'git submodule init' copy an existing
- setting to the worktree config if it belongs to the current worktree;
- otherwise, generate a new setting.
+ When extensions.worktreeConfig is enabled, an existing
+ `submodule.<name>.gitdir` setting in the repository config may have
+ been written by 'git submodule init' in another worktree. Reusing
+ that setting would cause the current worktree to use the submodule
+ gitdir of the other worktree.
+
+ Make 'git submodule init' copy an existing setting to the worktree
+ config only if it belongs to the current worktree; otherwise, generate
+ a new setting.
+
+ Warn when an existing setting does not match the current worktree and
+ is not copied to the worktree config.
Signed-off-by: Yoichi NAKAYAMA <[email protected]>
@@ builtin/submodule--helper.c: struct init_cb {
};
#define INIT_CB_INIT { 0 }
-+static int validate_submodule_git_dir_with_worktree(const char *gitdir)
++static bool submodule_git_dir_matches_current_worktree(const char *gitdir)
+{
+ struct strbuf tmp = STRBUF_INIT;
+ struct strbuf submodule = STRBUF_INIT;
+ char *super;
-+ int ret = 1;
++ bool matches;
+
+ if (is_absolute_path(gitdir))
+ strbuf_addstr(&submodule, gitdir);
+ else if (!repo_worktree_path_append(the_repository, &submodule,
+ "%s", gitdir))
-+ return -1;
++ return false;
+
+ if (strbuf_normalize_path(&submodule)) {
+ strbuf_release(&submodule);
-+ return -1;
++ return false;
+ }
+
+ super = absolute_pathdup(repo_get_git_dir(the_repository));
-+
-+ if (starts_with(relative_path(submodule.buf, super, &tmp), "modules/"))
-+ ret = 0;
++ matches = starts_with(relative_path(submodule.buf, super, &tmp),
++ "modules/");
+
+ strbuf_release(&submodule);
+ strbuf_release(&tmp);
+ free(super);
-+ return ret;
++ return matches;
+}
++
++static const char submodule_mismatch_warning[] = N_(
++"config '%s' exists but was not copied to the worktree config because "
++"it does not point to a gitdir for the current worktree. If you want "
++"to keep using this setting, copy it to the worktree config."
++);
+
static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path,
- const char *submodule_name)
@@ builtin/submodule--helper.c: struct init_cb {
+ struct worktree *wt)
{
- const char *value;
-+ const char *value = gitdir_path->buf;
-+ char *value_to_free = NULL;
++ char *value = NULL;
char *key;
if (validate_submodule_git_dir(gitdir_path->buf, submodule_name))
@@ builtin/submodule--helper.c: static int validate_and_set_submodule_gitdir(struct
+ * worktree.
+ */
+ if (!repo_config_get_string(the_repository, key, &tmp)) {
-+ if (validate_submodule_git_dir_with_worktree(tmp) ||
-+ validate_submodule_git_dir(tmp, submodule_name))
++ bool matches =
++ submodule_git_dir_matches_current_worktree(tmp);
++
++ if (!matches ||
++ validate_submodule_git_dir(tmp, submodule_name)) {
++ if (!matches)
++ warning(submodule_mismatch_warning, key);
+ free(tmp);
-+ else
-+ value = value_to_free = tmp;
++ } else {
++ value = tmp;
++ }
+ }
+ } else {
++ const char *value_;
++
+ /* Nothing to do if the config already exists. */
-+ if (!repo_config_get_string_tmp(the_repository, key, &value)) {
++ if (!repo_config_get_string_tmp(the_repository, key, &value_)) {
+ free(key);
+ return 0;
+ }
}
- if (repo_config_set_worktree_gently(the_repository, key, gitdir_path->buf)) {
-+ if (repo_config_set_worktree_gently(the_repository, key, value)) {
++ if (repo_config_set_worktree_gently(the_repository, key,
++ value ? value : gitdir_path->buf)) {
free(key);
-+ free(value_to_free);
++ free(value);
return -1;
}
free(key);
-+ free(value_to_free);
++ free(value);
return 0;
}
@@ t/t7425-submodule-gitdir-path-extension.sh: test_expect_success '`git clone --re
+ git config submodule.sub2.gitdir .git/modules/sub2_custom &&
+
+ git config extensions.worktreeConfig true &&
-+ git submodule init &&
++ git submodule init 2>err &&
++ test_must_be_empty err &&
+ git config --worktree submodule.sub1.gitdir >actual &&
+ echo ".git/modules/sub1_custom" >expect &&
+ test_cmp expect actual &&
@@ t/t7425-submodule-gitdir-path-extension.sh: test_expect_success '`git clone --re
+
+ git worktree add wt &&
+ cd wt &&
-+ git submodule init &&
++ git submodule init 2>err &&
++ test_grep "does not point to a gitdir for the current worktree" err &&
+ git config --worktree submodule.sub1.gitdir >actual &&
+ echo "../.git/worktrees/wt/modules/sub1" >expect &&
+ test_cmp expect actual &&
@@ t/t7425-submodule-gitdir-path-extension.sh: test_expect_success 'git submodule i
+ git config submodule.sub2.gitdir "$(cd .. && pwd -P)/.git/worktrees/wt/modules/sub2_custom" &&
+
+ git config extensions.worktreeConfig true &&
-+ git submodule init &&
++ git submodule init 2>err &&
++ test_must_be_empty err &&
+ git config --worktree submodule.sub1.gitdir >actual &&
+ echo "../.git/worktrees/wt/modules/sub1_custom" >expect &&
+ test_cmp expect actual &&
@@ t/t7425-submodule-gitdir-path-extension.sh: test_expect_success 'git submodule i
+ test_cmp expect actual &&
+
+ cd .. &&
-+ git submodule init &&
++ git submodule init 2>err &&
++ test_grep "does not point to a gitdir for the current worktree" err &&
+ git config --worktree submodule.sub1.gitdir >actual &&
+ echo ".git/modules/sub1" >expect &&
+ test_cmp expect actual &&Signature · 1 line
gitgitgadget
PATCH v2 1/3 submodule: make submodule.<name>.gitdir relative for worktrees
From: Yoichi NAKAYAMA <[email protected]>
For a linked worktree, always keep submodule.<name>.gitdir relative to ensure it continues to work when the worktree is moved along with the main worktree. (This benefit also requires worktree.useRelativePaths to be set to true.)
--- builtin/submodule--helper.c | 71 ++++++++++++++-------- t/t7425-submodule-gitdir-path-extension.sh | 19 ++++++ 2 files changed, 64 insertions(+), 26 deletions(-)
builtin/submodule--helper.c +45 -26
@@ -37,6 +37,7 @@#include "wildmatch.h" #include "strbuf.h" #include "url.h" +#include "worktree.h" #define OPT_QUIET (1 << 0)#define OPT_CACHED (1 << 1)
@@ -507,50 +508,63 @@ static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path,static void create_default_gitdir_config (const char *submodule_name) { +struct worktree *wt =get_current_worktree (the_repository); +const char *modules_dir; +struct strbuf tmp =STRBUF_INIT ;struct strbuf gitdir_path =STRBUF_INIT ;struct git_hash_ctx ctx;char hex_name_hash[GIT_MAX_HEXSZ +1 ], header[128 ];unsigned char raw_name_hash[GIT_MAX_RAWSZ ];int header_len; -/* Case 1: try the plain module name */ -repo_git_path_append (the_repository, &gitdir_path,"modules/%s" , submodule_name); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) { -strbuf_release (&gitdir_path); -return ; + modules_dir =worktree_git_path (wt,"modules/" ); +if (is_absolute_path (modules_dir)) { + modules_dir =relative_path (modules_dir, wt->path, &tmp); + }else { +strbuf_addstr (&tmp, modules_dir); + modules_dir = tmp.buf; } +/* Case 1: try the plain module name */ +strbuf_addstr (&gitdir_path, modules_dir); +strbuf_addstr (&gitdir_path, submodule_name); +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup; +/* Case 2.1: Try URI-safe (RFC3986) encoding first, this fixes nested gitdirs */ strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/" ); +strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_rfc3986_unreserved); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) { -strbuf_release (&gitdir_path); -return ; - } +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup;/* Case 2.2: Try extended uppercase URI (RFC3986) encoding, to fix case-folding */ strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/" ); +strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_casefolding_rfc3986_unreserved); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) -return ; +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup;/* Case 2.3: Try some derived gitdir names, see if one sticks */ for (char c ='0' ; c <='9' ; c++) {strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/" ); +strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_rfc3986_unreserved);strbuf_addch (&gitdir_path, c); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) -return ; +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup;strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/" ); +strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_casefolding_rfc3986_unreserved);strbuf_addch (&gitdir_path, c); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) -return ; +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup; }/* Case 2.4: If all the above failed, try a hash of the name as a last resort */
@@ -563,17 +577,22 @@ static void create_default_gitdir_config(const char *submodule_name)git_hash_final (raw_name_hash, &ctx);hash_to_hex_algop_r (hex_name_hash, raw_name_hash, the_hash_algo);strbuf_reset (&gitdir_path); -repo_git_path_append (the_repository, &gitdir_path,"modules/%s" , hex_name_hash); -if (!validate_and_set_submodule_gitdir (&gitdir_path, submodule_name)) { -strbuf_release (&gitdir_path); -return ; - } +strbuf_addstr (&gitdir_path, modules_dir); +strbuf_addstr (&gitdir_path, hex_name_hash); +if (!validate_and_set_submodule_gitdir (&gitdir_path, + submodule_name)) + goto cleanup;/* Case 3: nothing worked, error out */ die (_ ("failed to set a valid default config for 'submodule.%s.gitdir'. " "Please ensure it is set, for example by running something like: " -"'git config submodule.%s.gitdir .git/modules/%s'" ), - submodule_name, submodule_name, submodule_name); +"'git config submodule.%s.gitdir %s%s'" ), + submodule_name, submodule_name, modules_dir, submodule_name); + +cleanup: +strbuf_release (&gitdir_path); +strbuf_release (&tmp); +free_worktree (wt); } static void init_submodule(const char *path, const char *prefix,
t/t7425-submodule-gitdir-path-extension.sh +19 -0
@@ -279,6 +279,25 @@ test_expect_success '`git clone --recurse-submodules` respects init.defaultSubmo ) ' +test_expect_success 'git submodule init make gitdir relative' ' + test_when_finished "rm -rf repo-clone-init-wt" && + git clone upstream repo-clone-init-wt && + ( + cd repo-clone-init-wt && + git config core.repositoryformatversion 1 && + git config extensions.submodulePathConfig true && + git worktree add wt && + cd wt && + git submodule init && + git config submodule.sub1.gitdir >actual && + echo "../.git/worktrees/wt/modules/sub1" >expect && + test_cmp expect actual && + git config submodule.sub2.gitdir >actual && + echo "../.git/worktrees/wt/modules/sub2" >expect && + test_cmp expect actual + ) +' + test_expect_success 'submodule--helper migrates legacy modules' ' ( cd upstream &&
Signature · 1 line
gitgitgadget
PATCH v2 2/3 submodule: store settings in worktree config when enabled
In reply to Yoichi NAKAYAMA via GitGitGadgetFrom: Yoichi NAKAYAMA <[email protected]>
Submodule URLs can differ between branches. For example, one branch may use the upstream repository while another uses a fork for the same submodule. When these branches are checked out in separate worktrees, storing submodule.<name>.url in the shared repository config prevents each worktree from using its own URL.
Store submodule settings such as submodule.<name>.active and submodule.<name>.url in the worktree config when extensions.worktreeConfig is enabled.
Settings shared between worktrees can remain in the repository config. When such a setting exists there, 'git submodule deinit' sets submodule.<name>.active to false in the worktree config to unregister the submodule.
Unlike other settings, submodule.<name>.gitdir must not be shared between worktrees. Different commits in the superproject may record different commits for the same submodule. If the gitdir is shared, the submodule worktrees end up sharing the same HEAD and index, causing Git commands to behave incorrectly. Therefore, store this setting in the worktree config and exclude it from the config copied by 'git worktree add'.
--- Documentation/config/submodule.adoc | 3 +- builtin/submodule--helper.c | 43 ++++--- builtin/worktree.c | 23 ++++ t/t2405-worktree-submodule.sh | 129 +++++++++++++++++++++ t/t7425-submodule-gitdir-path-extension.sh | 49 ++++++++ 5 files changed, 227 insertions(+), 20 deletions(-)
Documentation/config/submodule.adoc +2 -1
@@ -58,7 +58,8 @@ submodule.<name>.gitdir:: respected when `extensions.submodulePathConfig` is enabled, otherwise it has no effect. When enabled, this config becomes the single source of truth for submodule gitdir paths and Git will error if it is missing. - See linkgit:git-config[1] for details. + When `extensions.worktreeConfig` is enabled, this setting is stored in + each worktree's config. See linkgit:git-config[1] for details. submodule.active:: A repeated field which contains a pathspec used to match against a
builtin/submodule--helper.c +24 -19
115 lines not on this page · raw message
builtin/worktree.c +23 -0
@@ -363,6 +363,9 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)if (file_exists (from_file)) {struct config_set cs = { {0 } };int bare; +struct string_list keys =STRING_LIST_INIT_DUP ; +struct string_list_item *item; +int i;if (safe_create_leading_directories (the_repository, to_file) ||copy_file (the_repository, to_file, from_file,0666 )) {
@@ -386,6 +389,26 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)error (_ ("failed to unset '%s' in '%s'" ),"core.worktree" , to_file); +/* unset "submodule.*.gitdir" */ +for (i =0 ; i < cs.list.nr; i++) { +const char *var = cs.list.items[i].e->key; +const char *subsection, *key; +size_t subsection_len; + +if (!parse_config_key (var,"submodule" , + &subsection, &subsection_len, &key) && + subsection && !strcmp (key,"gitdir" )) +string_list_insert (&keys, var); + } +for_each_string_list_item (item, &keys) { +if (repo_config_set_in_file_gently (the_repository, + to_file, item->string, +NULL ,NULL )) +error (_ ("failed to unset '%s' in '%s'" ), + item->string, to_file); + } +string_list_clear (&keys,0 ); +git_configset_clear (&cs); }
t/t2405-worktree-submodule.sh +129 -0
133 lines not on this page · raw message
t/t7425-submodule-gitdir-path-extension.sh +49 -0
55 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v2 3/3 submodule init: copy submodule.<name>.gitdir to config.worktree
In reply to Yoichi NAKAYAMA via GitGitGadgetFrom: Yoichi NAKAYAMA <[email protected]>
When extensions.worktreeConfig is enabled, an existing submodule.<name>.gitdir setting in the repository config may have been written by 'git submodule init' in another worktree. Reusing that setting would cause the current worktree to use the submodule gitdir of the other worktree.
Make 'git submodule init' copy an existing setting to the worktree config only if it belongs to the current worktree; otherwise, generate a new setting.
Warn when an existing setting does not match the current worktree and is not copied to the worktree config.
--- builtin/submodule--helper.c | 113 ++++++++++++++++++--- t/t7425-submodule-gitdir-path-extension.sh | 69 ++++++++++++- 2 files changed, 168 insertions(+), 14 deletions(-)
builtin/submodule--helper.c +100 -13
@@ -480,10 +480,45 @@ struct init_cb { };#define INIT_CB_INIT { 0 } +static bool submodule_git_dir_matches_current_worktree (const char *gitdir) +{ +struct strbuf tmp =STRBUF_INIT ; +struct strbuf submodule =STRBUF_INIT ; +char *super; +bool matches; + +if (is_absolute_path (gitdir)) +strbuf_addstr (&submodule, gitdir); +else if (!repo_worktree_path_append (the_repository, &submodule, +"%s" , gitdir)) +return false; + +if (strbuf_normalize_path (&submodule)) { +strbuf_release (&submodule); +return false; + } + + super =absolute_pathdup (repo_get_git_dir (the_repository)); + matches =starts_with (relative_path (submodule.buf, super, &tmp), +"modules/" ); + +strbuf_release (&submodule); +strbuf_release (&tmp); +free (super); +return matches; +} + +static const char submodule_mismatch_warning[] =N_ ( +"config '%s' exists but was not copied to the worktree config because " +"it does not point to a gitdir for the current worktree. If you want " +"to keep using this setting, copy it to the worktree config." +); +static int validate_and_set_submodule_gitdir (struct strbuf *gitdir_path, -const char *submodule_name) +const char *submodule_name, +struct worktree *wt) { -const char *value; +char *value =NULL ;char *key;if (validate_submodule_git_dir (gitdir_path->buf, submodule_name))
@@ -491,18 +526,64 @@ static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path, key =xstrfmt ("submodule.%s.gitdir" , submodule_name); -/* Nothing to do if the config already exists. */ -if (!repo_config_get_string_tmp (the_repository, key, &value)) { -free (key); -return 0 ; +if (the_repository->repository_format_worktree_config) { +struct config_set cs = {0 }; +const char *filename =worktree_git_path (wt,"config.worktree" ); +char *tmp; + +git_configset_init (&cs); +git_configset_add_file (&cs, filename); + +/* +* Nothing to do if the config already exists in the config set +* for the current worktree. +*/ +if (!git_configset_get (&cs, key)) { +git_configset_clear (&cs); +free (key); +return 0 ; + } + +git_configset_clear (&cs); + +/* +* If the worktree config does not have this key, check the +* effective value from lower-priority config scopes and copy +* it to the worktree config if it belongs to the current +* worktree. +*/ +if (!repo_config_get_string (the_repository, key, &tmp)) { +bool matches = +submodule_git_dir_matches_current_worktree (tmp); + +if (!matches || +validate_submodule_git_dir (tmp, submodule_name)) { +if (!matches) +warning (submodule_mismatch_warning, key); +free (tmp); + }else { + value = tmp; + } + } + }else { +const char *value_; + +/* Nothing to do if the config already exists. */ +if (!repo_config_get_string_tmp (the_repository, key, &value_)) { +free (key); +return 0 ; + } } -if (repo_config_set_worktree_gently (the_repository, key, gitdir_path->buf)) { +if (repo_config_set_worktree_gently (the_repository, key, + value ? value : gitdir_path->buf)) {free (key); +free (value);return -1 ; }free (key); +free (value);return 0 ; }
@@ -529,7 +610,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr (&gitdir_path, submodule_name);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;/* Case 2.1: Try URI-safe (RFC3986) encoding first, this fixes nested gitdirs */
@@ -537,7 +619,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_rfc3986_unreserved);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;/* Case 2.2: Try extended uppercase URI (RFC3986) encoding, to fix case-folding */
@@ -545,7 +628,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_casefolding_rfc3986_unreserved);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;/* Case 2.3: Try some derived gitdir names, see if one sticks */
@@ -555,7 +639,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_rfc3986_unreserved);strbuf_addch (&gitdir_path, c);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;strbuf_reset (&gitdir_path);
@@ -563,7 +648,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr_urlencode (&gitdir_path, submodule_name, is_casefolding_rfc3986_unreserved);strbuf_addch (&gitdir_path, c);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup; }
@@ -580,7 +666,8 @@ static void create_default_gitdir_config(const char *submodule_name)strbuf_addstr (&gitdir_path, modules_dir);strbuf_addstr (&gitdir_path, hex_name_hash);if (!validate_and_set_submodule_gitdir (&gitdir_path, - submodule_name)) + submodule_name, + wt)) goto cleanup;/* Case 3: nothing worked, error out */
t/t7425-submodule-gitdir-path-extension.sh +68 -1
81 lines not on this page · raw message
Signature · 1 line
gitgitgadget