# [PATCH] help.c: rename function "pretty_print_string_list"

2 messages from 2014-02-28 to 2014-02-28. Participants: Ralf Thielow, Junio C Hamano.
Thread: https://gitlist.dev/t/36001

## Ralf Thielow, 2014-02-28 19:27

Subject: [PATCH] help.c: rename function "pretty_print_string_list"
Message-ID: <1393615649-29248-1-git-send-email-ralf.thielow@gmail.com>
URL: https://gitlist.dev/e/1393615649-29248-1-git-send-email-ralf.thielow%40gmail.com

```
The part "string_list" of the name of function
"pretty_print_string_list" is just an implementation
detail. The function pretty-prints command names so
rename it to "pretty_print_cmdnames".

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
Just noticed this while digging through Git codebase.

 help.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/help.c b/help.c
index df7d16d..b266b09 100644
--- a/help.c
+++ b/help.c
@@ -78,8 +78,7 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
 	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;
@@ -209,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');
 	}
 }
-- 
1.9.0.164.g473e143

```

## Junio C Hamano, 2014-02-28 21:24

Subject: Re: [PATCH] help.c: rename function "pretty_print_string_list"
Message-ID: <xmqqfvn3szgt.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqfvn3szgt.fsf%40gitster.dls.corp.google.com
In-Reply-To: <1393615649-29248-1-git-send-email-ralf.thielow@gmail.com>

```
Ralf Thielow <ralf.thielow@gmail.com> writes:

> The part "string_list" of the name of function
> "pretty_print_string_list" is just an implementation
> detail. The function pretty-prints command names so
> rename it to "pretty_print_cmdnames".
>
> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
> ---
> Just noticed this while digging through Git codebase.

Thanks.  This is a leftover from 7dbc2c04 (git wrapper: basic
fixes., 2005-11-15); it used to be that this function was to pretty
print the contents of a string_list but it was updated to use its
own structure type.

>
>  help.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/help.c b/help.c
> index df7d16d..b266b09 100644
> --- a/help.c
> +++ b/help.c
> @@ -78,8 +78,7 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
>  	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;
> @@ -209,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');
>  	}
>  }

```
