submodule--helper: remove unused "list" helper
Remove the "submodule--helper list" sub-command, which hasn't been used by git-submodule.sh since2964d6e5e1
(submodule: port subcommand 'set-branch' from shell to C, 2020-06-02). There was a test added in2b56bb7a87
(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>
This commit is contained in:
parent
76d63ddc46
commit
31955475d1
@ -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},
|
||||
|
@ -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 &&
|
||||
|
Loading…
Reference in New Issue
Block a user