Skip to content

Commit 36d4516

Browse files
avargitster
authored andcommitted
submodule--helper: report "submodule" as our name in some "-h" output
Change the user-facing "git submodule--helper" commands so that they'll report their name as being "git submodule". To a user these commands are internal implementation details, and it doesn't make sense to emit usage about an internal helper when "git submodule" is invoked with invalid options. Before this we'd emit e.g.: $ git submodule absorbgitdirs --blah error: unknown option `blah' usage: git submodule--helper absorbgitdirs [<options>] [<path>...] [...] And: $ git submodule set-url -- -- usage: git submodule--helper set-url [--quiet] <path> <newurl> [...] Now we'll start with "usage: git submodule [...]" in both of those cases. This change does not alter the "list", "name", "clone", "config" and "create-branch" commands, those are internal-only (as an aside; their usage info should probably invoke BUG(...)). This only changes the user-facing commands. The "status", "deinit" and "update" commands are not included in this change, because their usage information already used "submodule" rather than "submodule--helper". I don't think it's currently possible to emit some of this usage information in practice, as git-submodule.sh will catch unknown options, and e.g. it doesn't seem to be possible to get "add" to emit its usage information from "submodule--helper". Though that change may be superfluous now, it's also harmless, and will allow us to eventually dispatch further into "git submodule--helper" from git-submodule.sh, while emitting the correct usage output. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6e556c4 commit 36d4516

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

builtin/submodule--helper.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
444444
};
445445

446446
const char *const git_submodule_helper_usage[] = {
447-
N_("git submodule--helper foreach [--quiet] [--recursive] [--] <command>"),
447+
N_("git submodule foreach [--quiet] [--recursive] [--] <command>"),
448448
NULL
449449
};
450450

@@ -582,7 +582,7 @@ static int module_init(int argc, const char **argv, const char *prefix)
582582
};
583583

584584
const char *const git_submodule_helper_usage[] = {
585-
N_("git submodule--helper init [<options>] [<path>]"),
585+
N_("git submodule init [<options>] [<path>]"),
586586
NULL
587587
};
588588

@@ -1185,7 +1185,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)
11851185
};
11861186

11871187
const char *const git_submodule_helper_usage[] = {
1188-
N_("git submodule--helper summary [<options>] [<commit>] [--] [<path>]"),
1188+
N_("git submodule summary [<options>] [<commit>] [--] [<path>]"),
11891189
NULL
11901190
};
11911191

@@ -1349,7 +1349,7 @@ static int module_sync(int argc, const char **argv, const char *prefix)
13491349
};
13501350

13511351
const char *const git_submodule_helper_usage[] = {
1352-
N_("git submodule--helper sync [--quiet] [--recursive] [<path>]"),
1352+
N_("git submodule sync [--quiet] [--recursive] [<path>]"),
13531353
NULL
13541354
};
13551355

@@ -2787,7 +2787,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
27872787
};
27882788

27892789
const char *const git_submodule_helper_usage[] = {
2790-
N_("git submodule--helper absorbgitdirs [<options>] [<path>...]"),
2790+
N_("git submodule absorbgitdirs [<options>] [<path>...]"),
27912791
NULL
27922792
};
27932793

@@ -2892,7 +2892,7 @@ static int module_set_url(int argc, const char **argv, const char *prefix)
28922892
OPT_END()
28932893
};
28942894
const char *const usage[] = {
2895-
N_("git submodule--helper set-url [--quiet] <path> <newurl>"),
2895+
N_("git submodule set-url [--quiet] <path> <newurl>"),
28962896
NULL
28972897
};
28982898

@@ -2931,8 +2931,8 @@ static int module_set_branch(int argc, const char **argv, const char *prefix)
29312931
OPT_END()
29322932
};
29332933
const char *const usage[] = {
2934-
N_("git submodule--helper set-branch [-q|--quiet] (-d|--default) <path>"),
2935-
N_("git submodule--helper set-branch [-q|--quiet] (-b|--branch) <branch> <path>"),
2934+
N_("git submodule set-branch [-q|--quiet] (-d|--default) <path>"),
2935+
N_("git submodule set-branch [-q|--quiet] (-b|--branch) <branch> <path>"),
29362936
NULL
29372937
};
29382938

@@ -3276,7 +3276,7 @@ static int module_add(int argc, const char **argv, const char *prefix)
32763276
};
32773277

32783278
const char *const usage[] = {
3279-
N_("git submodule--helper add [<options>] [--] <repository> [<path>]"),
3279+
N_("git submodule add [<options>] [--] <repository> [<path>]"),
32803280
NULL
32813281
};
32823282

0 commit comments

Comments
 (0)