Re: [PATCH v5 1/6] generate-cmdlist: parse common group commands
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 11, 2015, 06:12 UTC
- Message-ID
- <CAPig+cQfY+_4qYKR9vSeuwDe1Am3Csh1Q5M1CZbpvCCRHCdkKg@mail.gmail.com>
- In-Reply-To
- <1431191856-10949-2-git-send-email-sebastien.guimmara@gmail.com>
On Sat, May 9, 2015 at 1:17 PM, Sébastien Guimmara <sebastien.guimmara@gmail.com> wrote:
> Parse the [common] block to create the array of group descriptions:
Since you're resending a patch which I authored[1], the very first line of the email body should be:
From: Eric Sunshine <sunshine@sunshineco.com>
which git-am will pick up automatically in order to assign proper attribution when the patch is applied.
More below.
Show 18 quoted lines
> static char *common_cmd_groups[] = {
> [...]
> };
>
> then map each element of common_cmds[] to a group via its index:
>
> static struct cmdname_help common_cmds[] = {
> [...]
> };
>
> so that 'git help' can print those commands grouped by theme.
>
> Only commands tagged with an attribute from [common] are emitted to
> common_cmds[].
>
> [commit message by Sébastien Guimmara <sebastien.guimmara@gmail.com>]
>
> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>Likewise, since you're resending[1] this patch you should add your own sign-off following the sign-off of the patch's author.
> --- > generate-cmdlist.awk | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > create mode 100644 generate-cmdlist.awk
Each patch should be a self-contained logical unit, even if multiple files are touched.
In addition to introducing generate-cmdlist.awk, the original patch I wrote[1] also changed Makefile and removed generate-cmdlist.sh. Those changes are a logical unit, and shouldn't be split up, as you did here with v5 by moving the Makefile modifications to patch 4/6. Removal of generate-cmdlist.sh seems to have been lost entirely in v5.
[1]: http://article.gmane.org/gmane.comp.version-control.git/268598
Show 46 quoted lines
> diff --git a/generate-cmdlist.awk b/generate-cmdlist.awk
> new file mode 100644
> index 0000000..cbaac88
> --- /dev/null
> +++ b/generate-cmdlist.awk
> @@ -0,0 +1,38 @@
> +BEGIN {
> + print "/* Automatically generated by generate-cmdlist.awk */\n"
> + print "struct cmdname_help {"
> + print "\tchar name[16];"
> + print "\tchar help[80];"
> + print "\tunsigned char group;"
> + print "};\n"
> + print "static char *common_cmd_groups[] = {"
> +}
> +/^#/ || /^[ ]*$/ { next }
> +state == 2 {
> + for (i = 2; i <= NF; i++)
> + if (grp[$i]) {
> + f = "Documentation/"$1".txt"
> + while (getline s <f > 0)
> + if (match(s, $1" - ")) {
> + t = substr(s, length($1" - ") + 1)
> + break
> + }
> + close(f)
> + printf "\t{\"%s\", N_(\"%s\"), %s},\n",
> + substr($1, length("git-") + 1), t, grp[$i] - 1
> + break
> + }
> +}
> +/\[commands\]/ {
> + print "};\n\nstatic struct cmdname_help common_cmds[] = {"
> + state = 2
> +}
> +state == 1 {
> + grp[$1] = ++n
> + sub($1"[ ][ ]*", "")
> + printf "\tN_(\"%s\"),\n", $0
> +}
> +/\[common\]/ {
> + state = 1
> +}
> +END { print "};" }
> --
> 2.4.0