submodule--helper style: don't separate declared variables with \n\n
The usual style in the codebase is to separate declared variables with
a single newline, not two, let's adjust this code to conform to
that. This makes the eventual addition of various "int ret" variables
more consistent.
In doing this the comment added in 2964d6e5e1
(submodule: port
subcommand 'set-branch' from shell to C, 2020-06-02) might become
ambiguous to some, although it should be clear what it's referring to,
let's move it above the 'OPT_NOOP_NOARG('q', "quiet")' to make that
clearer.
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:

committed by
Junio C Hamano

parent
96a28a9bc6
commit
e2d5c886bf
@ -368,14 +368,12 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
|
|||||||
struct foreach_cb info = FOREACH_CB_INIT;
|
struct foreach_cb info = FOREACH_CB_INIT;
|
||||||
struct pathspec pathspec;
|
struct pathspec pathspec;
|
||||||
struct module_list list = MODULE_LIST_INIT;
|
struct module_list list = MODULE_LIST_INIT;
|
||||||
|
|
||||||
struct option module_foreach_options[] = {
|
struct option module_foreach_options[] = {
|
||||||
OPT__QUIET(&info.quiet, N_("suppress output of entering each submodule command")),
|
OPT__QUIET(&info.quiet, N_("suppress output of entering each submodule command")),
|
||||||
OPT_BOOL(0, "recursive", &info.recursive,
|
OPT_BOOL(0, "recursive", &info.recursive,
|
||||||
N_("recurse into nested submodules")),
|
N_("recurse into nested submodules")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule foreach [--quiet] [--recursive] [--] <command>"),
|
N_("git submodule foreach [--quiet] [--recursive] [--] <command>"),
|
||||||
NULL
|
NULL
|
||||||
@ -504,12 +502,10 @@ static int module_init(int argc, const char **argv, const char *prefix)
|
|||||||
struct pathspec pathspec;
|
struct pathspec pathspec;
|
||||||
struct module_list list = MODULE_LIST_INIT;
|
struct module_list list = MODULE_LIST_INIT;
|
||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
|
|
||||||
struct option module_init_options[] = {
|
struct option module_init_options[] = {
|
||||||
OPT__QUIET(&quiet, N_("suppress output for initializing a submodule")),
|
OPT__QUIET(&quiet, N_("suppress output for initializing a submodule")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule init [<options>] [<path>]"),
|
N_("git submodule init [<options>] [<path>]"),
|
||||||
NULL
|
NULL
|
||||||
@ -682,14 +678,12 @@ static int module_status(int argc, const char **argv, const char *prefix)
|
|||||||
struct pathspec pathspec;
|
struct pathspec pathspec;
|
||||||
struct module_list list = MODULE_LIST_INIT;
|
struct module_list list = MODULE_LIST_INIT;
|
||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
|
|
||||||
struct option module_status_options[] = {
|
struct option module_status_options[] = {
|
||||||
OPT__QUIET(&quiet, N_("suppress submodule status output")),
|
OPT__QUIET(&quiet, N_("suppress submodule status output")),
|
||||||
OPT_BIT(0, "cached", &info.flags, N_("use commit stored in the index instead of the one stored in the submodule HEAD"), OPT_CACHED),
|
OPT_BIT(0, "cached", &info.flags, N_("use commit stored in the index instead of the one stored in the submodule HEAD"), OPT_CACHED),
|
||||||
OPT_BIT(0, "recursive", &info.flags, N_("recurse into nested submodules"), OPT_RECURSIVE),
|
OPT_BIT(0, "recursive", &info.flags, N_("recurse into nested submodules"), OPT_RECURSIVE),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule status [--quiet] [--cached] [--recursive] [<path>...]"),
|
N_("git submodule status [--quiet] [--cached] [--recursive] [<path>...]"),
|
||||||
NULL
|
NULL
|
||||||
@ -1082,7 +1076,6 @@ static int module_summary(int argc, const char **argv, const char *prefix)
|
|||||||
enum diff_cmd diff_cmd = DIFF_INDEX;
|
enum diff_cmd diff_cmd = DIFF_INDEX;
|
||||||
struct object_id head_oid;
|
struct object_id head_oid;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
struct option module_summary_options[] = {
|
struct option module_summary_options[] = {
|
||||||
OPT_BOOL(0, "cached", &cached,
|
OPT_BOOL(0, "cached", &cached,
|
||||||
N_("use the commit stored in the index instead of the submodule HEAD")),
|
N_("use the commit stored in the index instead of the submodule HEAD")),
|
||||||
@ -1094,7 +1087,6 @@ static int module_summary(int argc, const char **argv, const char *prefix)
|
|||||||
N_("limit the summary size")),
|
N_("limit the summary size")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule summary [<options>] [<commit>] [--] [<path>]"),
|
N_("git submodule summary [<options>] [<commit>] [--] [<path>]"),
|
||||||
NULL
|
NULL
|
||||||
@ -1251,14 +1243,12 @@ static int module_sync(int argc, const char **argv, const char *prefix)
|
|||||||
struct module_list list = MODULE_LIST_INIT;
|
struct module_list list = MODULE_LIST_INIT;
|
||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
int recursive = 0;
|
int recursive = 0;
|
||||||
|
|
||||||
struct option module_sync_options[] = {
|
struct option module_sync_options[] = {
|
||||||
OPT__QUIET(&quiet, N_("suppress output of synchronizing submodule url")),
|
OPT__QUIET(&quiet, N_("suppress output of synchronizing submodule url")),
|
||||||
OPT_BOOL(0, "recursive", &recursive,
|
OPT_BOOL(0, "recursive", &recursive,
|
||||||
N_("recurse into nested submodules")),
|
N_("recurse into nested submodules")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule sync [--quiet] [--recursive] [<path>]"),
|
N_("git submodule sync [--quiet] [--recursive] [<path>]"),
|
||||||
NULL
|
NULL
|
||||||
@ -1390,14 +1380,12 @@ static int module_deinit(int argc, const char **argv, const char *prefix)
|
|||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
int force = 0;
|
int force = 0;
|
||||||
int all = 0;
|
int all = 0;
|
||||||
|
|
||||||
struct option module_deinit_options[] = {
|
struct option module_deinit_options[] = {
|
||||||
OPT__QUIET(&quiet, N_("suppress submodule status output")),
|
OPT__QUIET(&quiet, N_("suppress submodule status output")),
|
||||||
OPT__FORCE(&force, N_("remove submodule working trees even if they contain local changes"), 0),
|
OPT__FORCE(&force, N_("remove submodule working trees even if they contain local changes"), 0),
|
||||||
OPT_BOOL(0, "all", &all, N_("unregister all submodules")),
|
OPT_BOOL(0, "all", &all, N_("unregister all submodules")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule deinit [--quiet] [-f | --force] [--all | [--] [<path>...]]"),
|
N_("git submodule deinit [--quiet] [-f | --force] [--all | [--] [<path>...]]"),
|
||||||
NULL
|
NULL
|
||||||
@ -1666,7 +1654,6 @@ static int module_clone(int argc, const char **argv, const char *prefix)
|
|||||||
int dissociate = 0, quiet = 0, progress = 0, require_init = 0;
|
int dissociate = 0, quiet = 0, progress = 0, require_init = 0;
|
||||||
struct module_clone_data clone_data = MODULE_CLONE_DATA_INIT;
|
struct module_clone_data clone_data = MODULE_CLONE_DATA_INIT;
|
||||||
struct list_objects_filter_options filter_options;
|
struct list_objects_filter_options filter_options;
|
||||||
|
|
||||||
struct option module_clone_options[] = {
|
struct option module_clone_options[] = {
|
||||||
OPT_STRING(0, "prefix", &clone_data.prefix,
|
OPT_STRING(0, "prefix", &clone_data.prefix,
|
||||||
N_("path"),
|
N_("path"),
|
||||||
@ -1698,7 +1685,6 @@ static int module_clone(int argc, const char **argv, const char *prefix)
|
|||||||
OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
|
OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule--helper clone [--prefix=<path>] [--quiet] "
|
N_("git submodule--helper clone [--prefix=<path>] [--quiet] "
|
||||||
"[--reference <repository>] [--name <name>] [--depth <depth>] "
|
"[--reference <repository>] [--name <name>] [--depth <depth>] "
|
||||||
@ -2486,7 +2472,6 @@ static int module_update(int argc, const char **argv, const char *prefix)
|
|||||||
struct update_data opt = UPDATE_DATA_INIT;
|
struct update_data opt = UPDATE_DATA_INIT;
|
||||||
struct list_objects_filter_options filter_options;
|
struct list_objects_filter_options filter_options;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
struct option module_update_options[] = {
|
struct option module_update_options[] = {
|
||||||
OPT__FORCE(&opt.force, N_("force checkout updates"), 0),
|
OPT__FORCE(&opt.force, N_("force checkout updates"), 0),
|
||||||
OPT_BOOL(0, "init", &opt.init,
|
OPT_BOOL(0, "init", &opt.init,
|
||||||
@ -2530,7 +2515,6 @@ static int module_update(int argc, const char **argv, const char *prefix)
|
|||||||
OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
|
OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule [--quiet] update"
|
N_("git submodule [--quiet] update"
|
||||||
" [--init [--filter=<filter-spec>]] [--remote]"
|
" [--init [--filter=<filter-spec>]] [--remote]"
|
||||||
@ -2679,7 +2663,6 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
|
|||||||
struct pathspec pathspec;
|
struct pathspec pathspec;
|
||||||
struct module_list list = MODULE_LIST_INIT;
|
struct module_list list = MODULE_LIST_INIT;
|
||||||
unsigned flags = ABSORB_GITDIR_RECURSE_SUBMODULES;
|
unsigned flags = ABSORB_GITDIR_RECURSE_SUBMODULES;
|
||||||
|
|
||||||
struct option embed_gitdir_options[] = {
|
struct option embed_gitdir_options[] = {
|
||||||
OPT_STRING(0, "prefix", &prefix,
|
OPT_STRING(0, "prefix", &prefix,
|
||||||
N_("path"),
|
N_("path"),
|
||||||
@ -2688,7 +2671,6 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
|
|||||||
ABSORB_GITDIR_RECURSE_SUBMODULES),
|
ABSORB_GITDIR_RECURSE_SUBMODULES),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule absorbgitdirs [<options>] [<path>...]"),
|
N_("git submodule absorbgitdirs [<options>] [<path>...]"),
|
||||||
NULL
|
NULL
|
||||||
@ -2712,7 +2694,6 @@ static int module_config(int argc, const char **argv, const char *prefix)
|
|||||||
CHECK_WRITEABLE = 1,
|
CHECK_WRITEABLE = 1,
|
||||||
DO_UNSET = 2
|
DO_UNSET = 2
|
||||||
} command = 0;
|
} command = 0;
|
||||||
|
|
||||||
struct option module_config_options[] = {
|
struct option module_config_options[] = {
|
||||||
OPT_CMDMODE(0, "check-writeable", &command,
|
OPT_CMDMODE(0, "check-writeable", &command,
|
||||||
N_("check if it is safe to write to the .gitmodules file"),
|
N_("check if it is safe to write to the .gitmodules file"),
|
||||||
@ -2758,7 +2739,6 @@ static int module_set_url(int argc, const char **argv, const char *prefix)
|
|||||||
const char *newurl;
|
const char *newurl;
|
||||||
const char *path;
|
const char *path;
|
||||||
char *config_name;
|
char *config_name;
|
||||||
|
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT__QUIET(&quiet, N_("suppress output for setting url of a submodule")),
|
OPT__QUIET(&quiet, N_("suppress output for setting url of a submodule")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
@ -2789,13 +2769,13 @@ static int module_set_branch(int argc, const char **argv, const char *prefix)
|
|||||||
const char *opt_branch = NULL;
|
const char *opt_branch = NULL;
|
||||||
const char *path;
|
const char *path;
|
||||||
char *config_name;
|
char *config_name;
|
||||||
|
|
||||||
/*
|
|
||||||
* We accept the `quiet` option for uniformity across subcommands,
|
|
||||||
* though there is nothing to make less verbose in this subcommand.
|
|
||||||
*/
|
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
|
/*
|
||||||
|
* We accept the `quiet` option for uniformity across subcommands,
|
||||||
|
* though there is nothing to make less verbose in this subcommand.
|
||||||
|
*/
|
||||||
OPT_NOOP_NOARG('q', "quiet"),
|
OPT_NOOP_NOARG('q', "quiet"),
|
||||||
|
|
||||||
OPT_BOOL('d', "default", &opt_default,
|
OPT_BOOL('d', "default", &opt_default,
|
||||||
N_("set the default tracking branch to master")),
|
N_("set the default tracking branch to master")),
|
||||||
OPT_STRING('b', "branch", &opt_branch, N_("branch"),
|
OPT_STRING('b', "branch", &opt_branch, N_("branch"),
|
||||||
@ -2830,7 +2810,6 @@ static int module_create_branch(int argc, const char **argv, const char *prefix)
|
|||||||
{
|
{
|
||||||
enum branch_track track;
|
enum branch_track track;
|
||||||
int quiet = 0, force = 0, reflog = 0, dry_run = 0;
|
int quiet = 0, force = 0, reflog = 0, dry_run = 0;
|
||||||
|
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT__QUIET(&quiet, N_("print only error messages")),
|
OPT__QUIET(&quiet, N_("print only error messages")),
|
||||||
OPT__FORCE(&force, N_("force creation"), 0),
|
OPT__FORCE(&force, N_("force creation"), 0),
|
||||||
@ -3129,7 +3108,6 @@ static int module_add(int argc, const char **argv, const char *prefix)
|
|||||||
int force = 0, quiet = 0, progress = 0, dissociate = 0;
|
int force = 0, quiet = 0, progress = 0, dissociate = 0;
|
||||||
struct add_data add_data = ADD_DATA_INIT;
|
struct add_data add_data = ADD_DATA_INIT;
|
||||||
char *to_free = NULL;
|
char *to_free = NULL;
|
||||||
|
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT_STRING('b', "branch", &add_data.branch, N_("branch"),
|
OPT_STRING('b', "branch", &add_data.branch, N_("branch"),
|
||||||
N_("branch of repository to add as submodule")),
|
N_("branch of repository to add as submodule")),
|
||||||
@ -3146,7 +3124,6 @@ static int module_add(int argc, const char **argv, const char *prefix)
|
|||||||
OPT_INTEGER(0, "depth", &add_data.depth, N_("depth for shallow clones")),
|
OPT_INTEGER(0, "depth", &add_data.depth, N_("depth for shallow clones")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const usage[] = {
|
const char *const usage[] = {
|
||||||
N_("git submodule add [<options>] [--] <repository> [<path>]"),
|
N_("git submodule add [<options>] [--] <repository> [<path>]"),
|
||||||
NULL
|
NULL
|
||||||
|
Reference in New Issue
Block a user