]> git.ipfire.org Git - thirdparty/git.git/blobdiff - parse-options.c
Merge branch 'dd/mailinfo-with-nul'
[thirdparty/git.git] / parse-options.c
index 63d6bab60c0ef7ea4a836c6c8dc3f70daf8516d4..c57618d53736c754cee32b341f7c97d881c3036c 100644 (file)
@@ -648,6 +648,7 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
                int short_name;
                const char *long_name;
                const char *source;
+               struct strbuf help = STRBUF_INIT;
                int j;
 
                if (newopt[i].type != OPTION_ALIAS)
@@ -659,6 +660,7 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
 
                if (!long_name)
                        BUG("An alias must have long option name");
+               strbuf_addf(&help, _("alias of --%s"), source);
 
                for (j = 0; j < nr; j++) {
                        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)
                                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));
                        newopt[i].short_name = short_name;
                        newopt[i].long_name = long_name;
+                       newopt[i].help = strbuf_detach(&help, NULL);
                        break;
                }