aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-09-01 01:17:46 +0200
committerJunio C Hamano <gitster@pobox.com>2022-09-02 09:16:23 -0700
commit31955475d1c283120d5d84247eb3fd55d9f5fdd9 (patch)
tree8513ad9a6445efc276df5f454213c8312a663b6a
parent76d63ddc467c28263d7c5f48baf3894354056743 (diff)
downloadgit-31955475d1c283120d5d84247eb3fd55d9f5fdd9.tar.gz
submodule--helper: remove unused "list" helper
Remove the "submodule--helper list" sub-command, which hasn't been used by git-submodule.sh since 2964d6e5e1e (submodule: port subcommand 'set-branch' from shell to C, 2020-06-02). There was a test added in 2b56bb7a87a (submodule helper list: respect correct path prefix, 2016-02-24) which relied on it, but the right thing to do here is to delete that test as well. That test was regression testing the "list" subcommand itself. We're not getting anything useful from the "list | cut -f2" invocation that we couldn't get from "foreach 'echo $sm_path'". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/submodule--helper.c40
-rwxr-xr-xt/t7400-submodule-basic.sh25
2 files changed, 0 insertions, 65 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index ac2553ba9d..47ed24c6a6 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -266,45 +266,6 @@ static char *get_up_path(const char *path)
return strbuf_detach(&sb, NULL);
}
-static int module_list(int argc, const char **argv, const char *prefix)
-{
- int i;
- struct pathspec pathspec;
- struct module_list list = MODULE_LIST_INIT;
-
- struct option module_list_options[] = {
- OPT_STRING(0, "prefix", &prefix,
- N_("path"),
- N_("alternative anchor for relative paths")),
- OPT_END()
- };
-
- const char *const git_submodule_helper_usage[] = {
- N_("git submodule--helper list [--prefix=<path>] [<path>...]"),
- NULL
- };
-
- argc = parse_options(argc, argv, prefix, module_list_options,
- git_submodule_helper_usage, 0);
-
- if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
- return 1;
-
- for (i = 0; i < list.nr; i++) {
- const struct cache_entry *ce = list.entries[i];
-
- if (ce_stage(ce))
- printf("%06o %s U\t", ce->ce_mode,
- oid_to_hex(null_oid()));
- else
- printf("%06o %s %d\t", ce->ce_mode,
- oid_to_hex(&ce->oid), ce_stage(ce));
-
- fprintf(stdout, "%s\n", ce->name);
- }
- return 0;
-}
-
static void for_each_listed_submodule(const struct module_list *list,
each_submodule_fn fn, void *cb_data)
{
@@ -3340,7 +3301,6 @@ struct cmd_struct {
};
static struct cmd_struct commands[] = {
- {"list", module_list, 0},
{"clone", module_clone, SUPPORT_SUPER_PREFIX},
{"add", module_add, 0},
{"update", module_update, SUPPORT_SUPER_PREFIX},
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 6a77d817a8..b50db3f103 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -1255,31 +1255,6 @@ test_expect_success 'submodule add clone shallow submodule' '
)
'
-test_expect_success 'submodule helper list is not confused by common prefixes' '
- mkdir -p dir1/b &&
- (
- cd dir1/b &&
- git init &&
- echo hi >testfile2 &&
- git add . &&
- git commit -m "test1"
- ) &&
- mkdir -p dir2/b &&
- (
- cd dir2/b &&
- git init &&
- echo hello >testfile1 &&
- git add . &&
- git commit -m "test2"
- ) &&
- git submodule add /dir1/b dir1/b &&
- git submodule add /dir2/b dir2/b &&
- git commit -m "first submodule commit" &&
- git submodule--helper list dir1/b | cut -f 2 >actual &&
- echo "dir1/b" >expect &&
- test_cmp expect actual
-'
-
test_expect_success 'setup superproject with submodules' '
git init sub1 &&
test_commit -C sub1 test &&