help: replace underlining "help -a" headers using hyphens with a blank line

We used to underline a header text, like this: This is a header ---------------- content... But calculating text length so that the dashes align with the text could get complicated because the text could be in any charset in translated Git. There is no point to use this pseudo underline; simply a blank line would do and it even makes it easier to read: This is a header content... While at it, give translators more context to translate, e.g. e.g. "git commands available..." instead of "%s available..." Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Apr 25, 2012 at 18:21 UTC 4470ef94973cf40bb83864d480cee1e064053879
3 files changed +5 -16
builtin/help.c
+1 -1
@@ -425,7 +425,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
425
426 if (show_all) {
427 printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
428 - list_commands(_("git commands"), &main_cmds, &other_cmds);
428 + list_commands(&main_cmds, &other_cmds);
429 printf("%s\n", _(git_more_info_string));
430 return 0;
431 }
help.c
+3 -13
@@ -203,8 +203,7 @@ void load_command_list(const char *prefix,
203 exclude_cmds(other_cmds, main_cmds);
204 }
205
206 -void list_commands(const char *title, struct cmdnames *main_cmds,
207 - struct cmdnames *other_cmds)
206 +void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
207 {
208 int i, longest = 0;
209
@@ -217,23 +216,14 @@ void list_commands(const char *title, struct cmdnames *main_cmds,
216
217 if (main_cmds->cnt) {
218 const char *exec_path = git_exec_path();
220 - printf_ln(_("available %s in '%s'"), title, exec_path);
221 - /* TRANSLATORS: this must align with "available %s in '%s'" */
222 - printf(_("----------------"));
223 - mput_char('-', strlen(title) + strlen(exec_path));
219 + printf_ln(_("available git commands in '%s'"), exec_path);
220 putchar('\n');
221 pretty_print_string_list(main_cmds, longest);
222 putchar('\n');
223 }
224
225 if (other_cmds->cnt) {
230 - printf_ln(_("%s available from elsewhere on your $PATH"), title);
231 - /* TRANSLATORS:
232 - * this must align with
233 - * "%s available from elsewhere on your $PATH"
234 - */
235 - printf(_("---------------------------------------"));
236 - mput_char('-', strlen(title));
226 + printf_ln(_("git commands available from elsewhere on your $PATH"));
227 putchar('\n');
228 pretty_print_string_list(other_cmds, longest);
229 putchar('\n');
help.h
+1 -2
@@ -25,8 +25,7 @@ extern void add_cmdname(struct cmdnames *cmds, const char *name, int len);
25 /* Here we require that excludes is a sorted list. */
26 extern void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes);
27 extern int is_in_cmdlist(struct cmdnames *cmds, const char *name);
28 -extern void list_commands(const char *title,
29 - struct cmdnames *main_cmds,
28 +extern void list_commands(struct cmdnames *main_cmds,
29 struct cmdnames *other_cmds);
30
31 #endif /* HELP_H */