submodule API & "absorbgitdirs": remove "----recursive" option
Remove the "----recursive" option to "git submodule--helper absorbgitdirs" (yes, with 4 dashes, not 2). This option and all the "else" when "flags & ABSORB_GITDIR_RECURSE_SUBMODULES" is false has never been used since it was added in f6f85861400 (submodule: add absorb-git-dir function, 2016-12-12), which we'd have had to do as "----recursive", a "--recursive" would have errored out. It would be nice to follow-up with an optbug() assertion to parse-options.c for such funnily named options, I manually validated that this was the only long option whose name started with "-", but let's skip adding such an assertion for now. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Ævar Arnfjörð Bjarmason committed
Nov 8, 2022 at 15:10 UTC
82ff87789bdd972c9746ec184ae9464e58c8d29b
4 files changed
+7
-21
builtin/rm.c
+1
-2
@@ -86,8 +86,7 @@ static void submodules_absorb_gitdir_if_needed(void)
86
continue;
87
88
if (!submodule_uses_gitfile(name))
89
- absorb_git_dir_into_superproject(name,
90
- ABSORB_GITDIR_RECURSE_SUBMODULES);
89
+ absorb_git_dir_into_superproject(name);
90
}
91
}
92
builtin/submodule--helper.c
+2
-6
@@ -1379,8 +1379,7 @@ static void deinit_submodule(const char *path, const char *prefix,
1379
".git file by using absorbgitdirs."),
1380
displaypath);
1381
1382
- absorb_git_dir_into_superproject(path,
1383
- ABSORB_GITDIR_RECURSE_SUBMODULES);
1382
+ absorb_git_dir_into_superproject(path);
1383
1384
}
1385
@@ -2831,13 +2830,10 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
2830
int i;
2831
struct pathspec pathspec = { 0 };
2832
struct module_list list = MODULE_LIST_INIT;
2834
- unsigned flags = ABSORB_GITDIR_RECURSE_SUBMODULES;
2833
struct option embed_gitdir_options[] = {
2834
OPT_STRING(0, "prefix", &prefix,
2835
N_("path"),
2836
N_("path into the working tree")),
2839
- OPT_BIT(0, "--recursive", &flags, N_("recurse into submodules"),
2840
- ABSORB_GITDIR_RECURSE_SUBMODULES),
2837
OPT_END()
2838
};
2839
const char *const git_submodule_helper_usage[] = {
@@ -2853,7 +2849,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
2849
goto cleanup;
2850
2851
for (i = 0; i < list.nr; i++)
2856
- absorb_git_dir_into_superproject(list.entries[i]->name, flags);
2852
+ absorb_git_dir_into_superproject(list.entries[i]->name);
2853
2854
ret = 0;
2855
cleanup:
submodule.c
+3
-10
@@ -2139,8 +2139,7 @@ int submodule_move_head(const char *path,
2139
if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
2140
if (old_head) {
2141
if (!submodule_uses_gitfile(path))
2142
- absorb_git_dir_into_superproject(path,
2143
- ABSORB_GITDIR_RECURSE_SUBMODULES);
2142
+ absorb_git_dir_into_superproject(path);
2143
} else {
2144
struct strbuf gitdir = STRBUF_INIT;
2145
submodule_name_to_gitdir(&gitdir, the_repository,
@@ -2332,8 +2331,7 @@ static void absorb_git_dir_into_superproject_recurse(const char *path)
2331
* having its git directory within the working tree to the git dir nested
2332
* in its superprojects git dir under modules/.
2333
*/
2335
-void absorb_git_dir_into_superproject(const char *path,
2336
- unsigned flags)
2334
+void absorb_git_dir_into_superproject(const char *path)
2335
{
2336
int err_code;
2337
const char *sub_git_dir;
@@ -2382,12 +2380,7 @@ void absorb_git_dir_into_superproject(const char *path,
2380
}
2381
strbuf_release(&gitdir);
2382
2385
- if (flags & ABSORB_GITDIR_RECURSE_SUBMODULES) {
2386
- if (flags & ~ABSORB_GITDIR_RECURSE_SUBMODULES)
2387
- BUG("we don't know how to pass the flags down?");
2388
-
2389
- absorb_git_dir_into_superproject_recurse(path);
2390
- }
2383
+ absorb_git_dir_into_superproject_recurse(path);
2384
}
2385
2386
int get_superproject_working_tree(struct strbuf *buf)
submodule.h
+1
-3
@@ -164,9 +164,7 @@ void submodule_unset_core_worktree(const struct submodule *sub);
164
*/
165
void prepare_submodule_repo_env(struct strvec *env);
166
167
-#define ABSORB_GITDIR_RECURSE_SUBMODULES (1<<0)
168
-void absorb_git_dir_into_superproject(const char *path,
169
- unsigned flags);
167
+void absorb_git_dir_into_superproject(const char *path);
168
169
/*
170
* Return the absolute path of the working tree of the superproject, which this