Skip to content

Commit 82ff877

Browse files
avarttaylorr
authored andcommitted
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 f6f8586 (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 <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 46e87b5 commit 82ff877

File tree

4 files changed

+7
-21
lines changed

4 files changed

+7
-21
lines changed

builtin/rm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ static void submodules_absorb_gitdir_if_needed(void)
8686
continue;
8787

8888
if (!submodule_uses_gitfile(name))
89-
absorb_git_dir_into_superproject(name,
90-
ABSORB_GITDIR_RECURSE_SUBMODULES);
89+
absorb_git_dir_into_superproject(name);
9190
}
9291
}
9392

builtin/submodule--helper.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,8 +1379,7 @@ static void deinit_submodule(const char *path, const char *prefix,
13791379
".git file by using absorbgitdirs."),
13801380
displaypath);
13811381

1382-
absorb_git_dir_into_superproject(path,
1383-
ABSORB_GITDIR_RECURSE_SUBMODULES);
1382+
absorb_git_dir_into_superproject(path);
13841383

13851384
}
13861385

@@ -2831,13 +2830,10 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
28312830
int i;
28322831
struct pathspec pathspec = { 0 };
28332832
struct module_list list = MODULE_LIST_INIT;
2834-
unsigned flags = ABSORB_GITDIR_RECURSE_SUBMODULES;
28352833
struct option embed_gitdir_options[] = {
28362834
OPT_STRING(0, "prefix", &prefix,
28372835
N_("path"),
28382836
N_("path into the working tree")),
2839-
OPT_BIT(0, "--recursive", &flags, N_("recurse into submodules"),
2840-
ABSORB_GITDIR_RECURSE_SUBMODULES),
28412837
OPT_END()
28422838
};
28432839
const char *const git_submodule_helper_usage[] = {
@@ -2853,7 +2849,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
28532849
goto cleanup;
28542850

28552851
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);
28572853

28582854
ret = 0;
28592855
cleanup:

submodule.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,8 +2139,7 @@ int submodule_move_head(const char *path,
21392139
if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
21402140
if (old_head) {
21412141
if (!submodule_uses_gitfile(path))
2142-
absorb_git_dir_into_superproject(path,
2143-
ABSORB_GITDIR_RECURSE_SUBMODULES);
2142+
absorb_git_dir_into_superproject(path);
21442143
} else {
21452144
struct strbuf gitdir = STRBUF_INIT;
21462145
submodule_name_to_gitdir(&gitdir, the_repository,
@@ -2332,8 +2331,7 @@ static void absorb_git_dir_into_superproject_recurse(const char *path)
23322331
* having its git directory within the working tree to the git dir nested
23332332
* in its superprojects git dir under modules/.
23342333
*/
2335-
void absorb_git_dir_into_superproject(const char *path,
2336-
unsigned flags)
2334+
void absorb_git_dir_into_superproject(const char *path)
23372335
{
23382336
int err_code;
23392337
const char *sub_git_dir;
@@ -2382,12 +2380,7 @@ void absorb_git_dir_into_superproject(const char *path,
23822380
}
23832381
strbuf_release(&gitdir);
23842382

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);
23912384
}
23922385

23932386
int get_superproject_working_tree(struct strbuf *buf)

submodule.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ void submodule_unset_core_worktree(const struct submodule *sub);
164164
*/
165165
void prepare_submodule_repo_env(struct strvec *env);
166166

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);
170168

171169
/*
172170
* Return the absolute path of the working tree of the superproject, which this

0 commit comments

Comments
 (0)