Nguyễn Thái Ngọc Duy <[email protected]> writes:
> @@ -23,28 +36,44 @@ sed -n '
> ' "$1"
> printf '};\n\n'
>
> +echo "#define GROUP_NONE 0xff /* no common group */"
Some later code forgets about this value, and causes "git<ENTER>" to
segfault at the end of this entire series.
Namely, here:
> - for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
> + for (i = 0; i < nr; i++) {
> if (common_cmds[i].group != current_grp) {
> printf("\n%s\n",
> _(common_cmd_groups[common_cmds[i].group]));
> current_grp = common_cmds[i].group;
where common_cmd_groups[] gets overrun.
Here is a squash I'll queue on top to keep the tip of 'pu' at least
buildable.
help.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/help.c b/help.c
index a44f4a113e..74591d5ebc 100644
--- a/help.c
+++ b/help.c
@@ -242,7 +242,9 @@ void list_common_cmds_help(void)
puts(_("These are common Git commands used in various situations:"));
for (i = 0; i < nr; i++) {
- if (common_cmds[i].group != current_grp) {
+ if (ARRAY_SIZE(common_cmd_groups) <= common_cmds[i].group)
+ ; /* skip */
+ else if (common_cmds[i].group != current_grp) {
printf("\n%s\n",
_(common_cmd_groups[common_cmds[i].group]));
current_grp = common_cmds[i].group;
}