Skip to content

Commit d5509a3

Browse files
committed
Merge branch 'jc/log-no-mailmap' into pu
"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
2 parents ddffb9e + 88acccd commit d5509a3

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

Documentation/git-log.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ OPTIONS
4949
Print out the ref name given on the command line by which each
5050
commit was reached.
5151

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

builtin/clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ static struct option builtin_clone_options[] = {
102102
N_("don't use local hardlinks, always copy")),
103103
OPT_BOOL('s', "shared", &option_shared,
104104
N_("setup as shared repository")),
105-
OPT_ALIAS(0, "recursive", "recurse-submodules"),
106105
{ OPTION_CALLBACK, 0, "recurse-submodules", &option_recurse_submodules,
107106
N_("pathspec"), N_("initialize submodules in the clone"),
108107
PARSE_OPT_OPTARG, recurse_submodules_cb, (intptr_t)"." },
108+
OPT_ALIAS(0, "recursive", "recurse-submodules"),
109109
OPT_INTEGER('j', "jobs", &max_jobs,
110110
N_("number of submodules cloned in parallel")),
111111
OPT_STRING(0, "template", &option_template, N_("template-directory"),

builtin/log.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
173173
OPT__QUIET(&quiet, N_("suppress diff output")),
174174
OPT_BOOL(0, "source", &source, N_("show source")),
175175
OPT_BOOL(0, "use-mailmap", &mailmap, N_("Use mail map file")),
176+
OPT_ALIAS(0, "mailmap", "use-mailmap"),
176177
OPT_STRING_LIST(0, "decorate-refs", &decorate_refs_include,
177178
N_("pattern"), N_("only decorate refs that match <pattern>")),
178179
OPT_STRING_LIST(0, "decorate-refs-exclude", &decorate_refs_exclude,

parse-options.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
648648
int short_name;
649649
const char *long_name;
650650
const char *source;
651+
struct strbuf help = STRBUF_INIT;
651652
int j;
652653

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

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

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

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

t/t0040-parse-options.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Alias
5454
-A, --alias-source <string>
5555
get a string
5656
-Z, --alias-target <string>
57-
get a string
57+
alias of --alias-source
5858
5959
EOF
6060

0 commit comments

Comments
 (0)