aboutsummaryrefslogtreecommitdiff
path: root/help.c
diff options
context:
space:
mode:
Diffstat (limited to 'help.c')
-rw-r--r--help.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/help.c b/help.c
index a781ebb98d..82fb2eaa3f 100644
--- a/help.c
+++ b/help.c
@@ -21,6 +21,7 @@
#include "fsmonitor-ipc.h"
#include "repository.h"
#include "alias.h"
+#include "utf8.h"
#ifndef NO_CURL
#include "git-curl-compat.h" /* For LIBCURL_VERSION only */
@@ -108,7 +109,7 @@ static void print_command_list(const struct cmdname_help *cmds,
for (i = 0; cmds[i].name; i++) {
if (cmds[i].category & mask) {
- size_t len = strlen(cmds[i].name);
+ size_t len = utf8_strwidth(cmds[i].name);
printf(" %s ", cmds[i].name);
if (longest > len)
mput_char(' ', longest - len);
@@ -493,7 +494,7 @@ static void list_all_cmds_help_aliases(int longest)
string_list_sort(&alias_list);
for (i = 0; i < alias_list.nr; i++) {
- size_t len = strlen(alias_list.items[i].string);
+ size_t len = utf8_strwidth(alias_list.items[i].string);
if (longest < len)
longest = len;
}
@@ -592,8 +593,15 @@ static int git_unknown_cmd_config(const char *var, const char *value,
/* Also use aliases for command lookup */
if (!parse_config_key(var, "alias", &subsection, &subsection_len,
&key)) {
- if (!subsection)
+ if (subsection) {
+ /* [alias "name"] command = value */
+ if (!strcmp(key, "command"))
+ add_cmdname(&cfg->aliases, subsection,
+ subsection_len);
+ } else {
+ /* alias.name = value */
add_cmdname(&cfg->aliases, key, strlen(key));
+ }
}
return 0;