Merge branch 'rt/help-pretty-prints-cmd-names'
authorJunio C Hamano <gitster@pobox.com>
Fri, 14 Mar 2014 21:27:00 +0000 (14:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Mar 2014 21:27:00 +0000 (14:27 -0700)
* rt/help-pretty-prints-cmd-names:
help.c: rename function "pretty_print_string_list"

1  2 
help.c
diff --combined help.c
index df7d16d7ce52ce9b9f274db92b24aa64bac56ebf,5eb19f7a910c880dfd70dbdcdb304cdb103e0deb..b266b09320c067221eb4fffa56e4778d5f8b3a9e
--- 1/help.c
--- 2/help.c
+++ b/help.c
@@@ -78,8 -78,7 +78,7 @@@ void exclude_cmds(struct cmdnames *cmds
        cmds->cnt = cj;
  }
  
- static void pretty_print_string_list(struct cmdnames *cmds,
-                                    unsigned int colopts)
+ static void pretty_print_cmdnames(struct cmdnames *cmds, unsigned int colopts)
  {
        struct string_list list = STRING_LIST_INIT_NODUP;
        struct column_options copts;
@@@ -148,7 -147,7 +147,7 @@@ static void list_commands_in_dir(struc
        while ((de = readdir(dir)) != NULL) {
                int entlen;
  
 -              if (prefixcmp(de->d_name, prefix))
 +              if (!starts_with(de->d_name, prefix))
                        continue;
  
                strbuf_setlen(&buf, len);
@@@ -209,14 -208,14 +208,14 @@@ void list_commands(unsigned int colopts
                const char *exec_path = git_exec_path();
                printf_ln(_("available git commands in '%s'"), exec_path);
                putchar('\n');
-               pretty_print_string_list(main_cmds, colopts);
+               pretty_print_cmdnames(main_cmds, colopts);
                putchar('\n');
        }
  
        if (other_cmds->cnt) {
                printf_ln(_("git commands available from elsewhere on your $PATH"));
                putchar('\n');
-               pretty_print_string_list(other_cmds, colopts);
+               pretty_print_cmdnames(other_cmds, colopts);
                putchar('\n');
        }
  }
@@@ -255,7 -254,7 +254,7 @@@ static int git_unknown_cmd_config(cons
        if (!strcmp(var, "help.autocorrect"))
                autocorrect = git_config_int(var,value);
        /* Also use aliases for command lookup */
 -      if (!prefixcmp(var, "alias."))
 +      if (starts_with(var, "alias."))
                add_cmdname(&aliases, var + 6, strlen(var + 6));
  
        return git_default_config(var, value, cb);
@@@ -329,7 -328,7 +328,7 @@@ const char *help_unknown_cmd(const cha
                if ((n < ARRAY_SIZE(common_cmds)) && !cmp) {
                        /* Yes, this is one of the common commands */
                        n++; /* use the entry from common_cmds[] */
 -                      if (!prefixcmp(candidate, cmd)) {
 +                      if (starts_with(candidate, cmd)) {
                                /* Give prefix match a very good score */
                                main_cmds.names[i]->len = 0;
                                continue;
@@@ -414,7 -413,7 +413,7 @@@ static int append_similar_ref(const cha
        struct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data);
        char *branch = strrchr(refname, '/') + 1;
        /* A remote branch of the same name is deemed similar */
 -      if (!prefixcmp(refname, "refs/remotes/") &&
 +      if (starts_with(refname, "refs/remotes/") &&
            !strcmp(branch, cb->base_ref))
                string_list_append(cb->similar_refs,
                                   refname + strlen("refs/remotes/"));