]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule API & "absorbgitdirs": remove "----recursive" option
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 8 Nov 2022 14:10:37 +0000 (15:10 +0100)
committerTaylor Blau <me@ttaylorr.com>
Tue, 8 Nov 2022 19:55:30 +0000 (14:55 -0500)
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>
builtin/rm.c
builtin/submodule--helper.c
submodule.c
submodule.h

index f0d025a4e23d3ab28f34e282e0e2ef43459b2688..05bfe20a4690d35b4d4918e03de1bc8a1fc9ecad 100644 (file)
@@ -86,8 +86,7 @@ static void submodules_absorb_gitdir_if_needed(void)
                        continue;
 
                if (!submodule_uses_gitfile(name))
-                       absorb_git_dir_into_superproject(name,
-                               ABSORB_GITDIR_RECURSE_SUBMODULES);
+                       absorb_git_dir_into_superproject(name);
        }
 }
 
index ee6f2d34cbacd99991dfa54a53a4016afb7b268e..33f099dbc86214d63565ff17e500115470818d1d 100644 (file)
@@ -1379,8 +1379,7 @@ static void deinit_submodule(const char *path, const char *prefix,
                                          ".git file by using absorbgitdirs."),
                                        displaypath);
 
-                       absorb_git_dir_into_superproject(path,
-                                                        ABSORB_GITDIR_RECURSE_SUBMODULES);
+                       absorb_git_dir_into_superproject(path);
 
                }
 
@@ -2831,13 +2830,10 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
        int i;
        struct pathspec pathspec = { 0 };
        struct module_list list = MODULE_LIST_INIT;
-       unsigned flags = ABSORB_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"),
-                       ABSORB_GITDIR_RECURSE_SUBMODULES),
                OPT_END()
        };
        const char *const git_submodule_helper_usage[] = {
@@ -2853,7 +2849,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
                goto cleanup;
 
        for (i = 0; i < list.nr; i++)
-               absorb_git_dir_into_superproject(list.entries[i]->name, flags);
+               absorb_git_dir_into_superproject(list.entries[i]->name);
 
        ret = 0;
 cleanup:
index fe1e3f03905e281a86ea4d44bdbcbfa6278ce503..8fa2ad457b21e1a8d931b54a1a374afad2d2ab7c 100644 (file)
@@ -2139,8 +2139,7 @@ int submodule_move_head(const char *path,
        if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
                if (old_head) {
                        if (!submodule_uses_gitfile(path))
-                               absorb_git_dir_into_superproject(path,
-                                       ABSORB_GITDIR_RECURSE_SUBMODULES);
+                               absorb_git_dir_into_superproject(path);
                } else {
                        struct strbuf gitdir = STRBUF_INIT;
                        submodule_name_to_gitdir(&gitdir, the_repository,
@@ -2332,8 +2331,7 @@ static void absorb_git_dir_into_superproject_recurse(const char *path)
  * having its git directory within the working tree to the git dir nested
  * in its superprojects git dir under modules/.
  */
-void absorb_git_dir_into_superproject(const char *path,
-                                     unsigned flags)
+void absorb_git_dir_into_superproject(const char *path)
 {
        int err_code;
        const char *sub_git_dir;
@@ -2382,12 +2380,7 @@ void absorb_git_dir_into_superproject(const char *path,
        }
        strbuf_release(&gitdir);
 
-       if (flags & ABSORB_GITDIR_RECURSE_SUBMODULES) {
-               if (flags & ~ABSORB_GITDIR_RECURSE_SUBMODULES)
-                       BUG("we don't know how to pass the flags down?");
-
-               absorb_git_dir_into_superproject_recurse(path);
-       }
+       absorb_git_dir_into_superproject_recurse(path);
 }
 
 int get_superproject_working_tree(struct strbuf *buf)
index 6a9fec6de1159f0389df2391c2d18e8d5fd7d297..b52a4ff1e73e3b137b7cd1a01e420c7f302497e6 100644 (file)
@@ -164,9 +164,7 @@ void submodule_unset_core_worktree(const struct submodule *sub);
  */
 void prepare_submodule_repo_env(struct strvec *env);
 
-#define ABSORB_GITDIR_RECURSE_SUBMODULES (1<<0)
-void absorb_git_dir_into_superproject(const char *path,
-                                     unsigned flags);
+void absorb_git_dir_into_superproject(const char *path);
 
 /*
  * Return the absolute path of the working tree of the superproject, which this