diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-12-23 11:33:15 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-12-23 11:33:15 +0900 |
| commit | 00bf98b16e3dfaf0e980954a3add41818e4bb0c3 (patch) | |
| tree | a465682c7a6c1a3abc06b68981a51e6bf34d6049 /builtin | |
| parent | f0c063b67c66fa9eb377097efc7614c5f102c5be (diff) | |
| parent | dd8e8c786efdfb3ba588d807bfb0dc0d5196c343 (diff) | |
| download | git-00bf98b16e3dfaf0e980954a3add41818e4bb0c3.tar.xz | |
Merge branch 'jc/submodule-add'
"git submodule add" to add a submodule under <name> segfaulted,
when a submodule.<name>.something is already in .gitmodules file
without defining where its submodule.<name>.path is, which has been
corrected.
* jc/submodule-add:
submodule add: sanity check existing .gitmodules
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/submodule--helper.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 35f6cf735e..d537ab087a 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1903,6 +1903,13 @@ static int determine_submodule_update_strategy(struct repository *r, const char *val; int ret; + /* + * NEEDSWORK: audit and ensure that update_submodule() has right + * to assume that submodule_from_path() above will always succeed. + */ + if (!sub) + BUG("update_submodule assumes a submodule exists at path (%s)", + path); key = xstrfmt("submodule.%s.update", sub->name); if (update) { @@ -3527,14 +3534,15 @@ static int module_add(int argc, const char **argv, const char *prefix, } } - if(!add_data.sm_name) + if (!add_data.sm_name) add_data.sm_name = add_data.sm_path; existing = submodule_from_name(the_repository, null_oid(the_hash_algo), add_data.sm_name); - if (existing && strcmp(existing->path, add_data.sm_path)) { + if (existing && existing->path && + strcmp(existing->path, add_data.sm_path)) { if (!force) { die(_("submodule name '%s' already used for path '%s'"), add_data.sm_name, existing->path); |
