Merge branch 'jc/log-no-mailmap'

"git log" learns "--[no-]mailmap" as a synonym to "--[no-]use-mailmap"

* jc/log-no-mailmap:
  log: give --[no-]use-mailmap a more sensible synonym --[no-]mailmap
  clone: reorder --recursive/--recurse-submodules
  parse-options: teach "git cmd -h" to show alias as alias
maint
Junio C Hamano 2020-04-28 15:50:00 -07:00
commit 9404128b34
5 changed files with 7 additions and 8 deletions

View File

@ -49,6 +49,7 @@ OPTIONS
Print out the ref name given on the command line by which each Print out the ref name given on the command line by which each
commit was reached. commit was reached.


--[no-]mailmap::
--[no-]use-mailmap:: --[no-]use-mailmap::
Use mailmap file to map author and committer names and email Use mailmap file to map author and committer names and email
addresses to canonical real names and email addresses. See addresses to canonical real names and email addresses. See

View File

@ -102,10 +102,10 @@ static struct option builtin_clone_options[] = {
N_("don't use local hardlinks, always copy")), N_("don't use local hardlinks, always copy")),
OPT_BOOL('s', "shared", &option_shared, OPT_BOOL('s', "shared", &option_shared,
N_("setup as shared repository")), N_("setup as shared repository")),
OPT_ALIAS(0, "recursive", "recurse-submodules"),
{ OPTION_CALLBACK, 0, "recurse-submodules", &option_recurse_submodules, { OPTION_CALLBACK, 0, "recurse-submodules", &option_recurse_submodules,
N_("pathspec"), N_("initialize submodules in the clone"), N_("pathspec"), N_("initialize submodules in the clone"),
PARSE_OPT_OPTARG, recurse_submodules_cb, (intptr_t)"." }, PARSE_OPT_OPTARG, recurse_submodules_cb, (intptr_t)"." },
OPT_ALIAS(0, "recursive", "recurse-submodules"),
OPT_INTEGER('j', "jobs", &max_jobs, OPT_INTEGER('j', "jobs", &max_jobs,
N_("number of submodules cloned in parallel")), N_("number of submodules cloned in parallel")),
OPT_STRING(0, "template", &option_template, N_("template-directory"), OPT_STRING(0, "template", &option_template, N_("template-directory"),

View File

@ -175,6 +175,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
OPT__QUIET(&quiet, N_("suppress diff output")), OPT__QUIET(&quiet, N_("suppress diff output")),
OPT_BOOL(0, "source", &source, N_("show source")), OPT_BOOL(0, "source", &source, N_("show source")),
OPT_BOOL(0, "use-mailmap", &mailmap, N_("Use mail map file")), OPT_BOOL(0, "use-mailmap", &mailmap, N_("Use mail map file")),
OPT_ALIAS(0, "mailmap", "use-mailmap"),
OPT_STRING_LIST(0, "decorate-refs", &decorate_refs_include, OPT_STRING_LIST(0, "decorate-refs", &decorate_refs_include,
N_("pattern"), N_("only decorate refs that match <pattern>")), N_("pattern"), N_("only decorate refs that match <pattern>")),
OPT_STRING_LIST(0, "decorate-refs-exclude", &decorate_refs_exclude, OPT_STRING_LIST(0, "decorate-refs-exclude", &decorate_refs_exclude,

View File

@ -648,6 +648,7 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
int short_name; int short_name;
const char *long_name; const char *long_name;
const char *source; const char *source;
struct strbuf help = STRBUF_INIT;
int j; int j;


if (newopt[i].type != OPTION_ALIAS) if (newopt[i].type != OPTION_ALIAS)
@ -659,6 +660,7 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,


if (!long_name) if (!long_name)
BUG("An alias must have long option name"); BUG("An alias must have long option name");
strbuf_addf(&help, _("alias of --%s"), source);


for (j = 0; j < nr; j++) { for (j = 0; j < nr; j++) {
const char *name = options[j].long_name; const char *name = options[j].long_name;
@ -669,15 +671,10 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
if (options[j].type == OPTION_ALIAS) if (options[j].type == OPTION_ALIAS)
BUG("No please. Nested aliases are not supported."); BUG("No please. Nested aliases are not supported.");


/*
* NEEDSWORK: this is a bit inconsistent because
* usage_with_options() on the original options[] will print
* help string as "alias of %s" but "git cmd -h" will
* print the original help string.
*/
memcpy(newopt + i, options + j, sizeof(*newopt)); memcpy(newopt + i, options + j, sizeof(*newopt));
newopt[i].short_name = short_name; newopt[i].short_name = short_name;
newopt[i].long_name = long_name; newopt[i].long_name = long_name;
newopt[i].help = strbuf_detach(&help, NULL);
break; break;
} }



View File

@ -54,7 +54,7 @@ Alias
-A, --alias-source <string> -A, --alias-source <string>
get a string get a string
-Z, --alias-target <string> -Z, --alias-target <string>
get a string alias of --alias-source


EOF EOF