Skip to content

Commit 6af2c4a

Browse files
vdyegitster
authored andcommitted
test-submodule: remove command line handling for check-name
The 'check-name' subcommand to 'test-tool submodule' is documented as being able to take a command line argument '<name>'. However, this does not work - and has never worked - because 'argc > 0' triggers the usage message in 'cmd__submodule_check_name()'. To simplify the helper and avoid future confusion around proper use of the subcommand, remove any references to command line arguments for 'check-name' in usage strings and handling in 'check_name()'. Helped-by: Jeff King <[email protected]> Signed-off-by: Victoria Dye <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 13320ff commit 6af2c4a

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

t/helper/test-submodule.c

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "submodule.h"
99

1010
#define TEST_TOOL_CHECK_NAME_USAGE \
11-
"test-tool submodule check-name <name>"
11+
"test-tool submodule check-name"
1212
static const char *submodule_check_name_usage[] = {
1313
TEST_TOOL_CHECK_NAME_USAGE,
1414
NULL
@@ -35,26 +35,15 @@ static const char *submodule_usage[] = {
3535
NULL
3636
};
3737

38-
/*
39-
* Exit non-zero if any of the submodule names given on the command line is
40-
* invalid. If no names are given, filter stdin to print only valid names
41-
* (which is primarily intended for testing).
42-
*/
43-
static int check_name(int argc, const char **argv)
38+
/* Filter stdin to print only valid names. */
39+
static int check_name(void)
4440
{
45-
if (argc > 1) {
46-
while (*++argv) {
47-
if (check_submodule_name(*argv) < 0)
48-
return 1;
49-
}
50-
} else {
51-
struct strbuf buf = STRBUF_INIT;
52-
while (strbuf_getline(&buf, stdin) != EOF) {
53-
if (!check_submodule_name(buf.buf))
54-
printf("%s\n", buf.buf);
55-
}
56-
strbuf_release(&buf);
41+
struct strbuf buf = STRBUF_INIT;
42+
while (strbuf_getline(&buf, stdin) != EOF) {
43+
if (!check_submodule_name(buf.buf))
44+
printf("%s\n", buf.buf);
5745
}
46+
strbuf_release(&buf);
5847
return 0;
5948
}
6049

@@ -68,7 +57,7 @@ static int cmd__submodule_check_name(int argc, const char **argv)
6857
if (argc)
6958
usage_with_options(submodule_check_name_usage, options);
7059

71-
return check_name(argc, argv);
60+
return check_name();
7261
}
7362

7463
static int cmd__submodule_is_active(int argc, const char **argv)

0 commit comments

Comments
 (0)