Subject: Re: [PATCH 4/7] test-tool.h: ASCII-sort list of functions

From: Junio C Hamano <[email-masked]>
Date: Wed, 17 Mar 2021 10:54:41 -0700

Denton Liu <[email-masked]> writes:

> The list of test-tool functions have, over time, gotten slightly out of
> ASCII order. Sort this list to bring them back into order.
>
> ASCII sorting was chosen over strict alphabetical order for the same
> reason as 805d9eaf5e (Makefile: ASCII-sort += lists, 2020-03-21): the
> purpose of maintaining the sorted list is to ensure line insertions are
> deterministic. By using ASCII ordering, it is more easily mechanically
> reproducible in the future, such as by using :sort in Vim.

Likewise.  The rationale 805d9eaf (Makefile: ASCII-sort += lists,
2020-03-21) applies better for Makefile's "X += <name>" as the
prefix before the <name> are all common, while in the header files,
you have to depend on their return type being the same and '('
sorting before '_'.

Now I am inclined to say that it may be worth mentioning in the log,
both for this step and the previous one.

> This patch is best viewed with `--color-moved`.
>
> Signed-off-by: Denton Liu <[email-masked]>
> ---
>  t/helper/test-tool.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
> index 28072c0ad5..9856e84149 100644
> --- a/t/helper/test-tool.h
> +++ b/t/helper/test-tool.h
> @@ -22,14 +22,15 @@ int cmd__example_decorate(int argc, const char **argv);
>  int cmd__fast_rebase(int argc, const char **argv);
>  int cmd__genrandom(int argc, const char **argv);
>  int cmd__genzeros(int argc, const char **argv);
> -int cmd__hashmap(int argc, const char **argv);
>  int cmd__hash_speed(int argc, const char **argv);
> +int cmd__hashmap(int argc, const char **argv);
>  int cmd__index_version(int argc, const char **argv);
>  int cmd__json_writer(int argc, const char **argv);
>  int cmd__lazy_init_name_hash(int argc, const char **argv);
>  int cmd__match_trees(int argc, const char **argv);
>  int cmd__mergesort(int argc, const char **argv);
>  int cmd__mktemp(int argc, const char **argv);
> +int cmd__oid_array(int argc, const char **argv);
>  int cmd__oidmap(int argc, const char **argv);
>  int cmd__online_cpus(int argc, const char **argv);
>  int cmd__parse_options(int argc, const char **argv);
> @@ -52,7 +53,6 @@ int cmd__run_command(int argc, const char **argv);
>  int cmd__scrap_cache_tree(int argc, const char **argv);
>  int cmd__serve_v2(int argc, const char **argv);
>  int cmd__sha1(int argc, const char **argv);
> -int cmd__oid_array(int argc, const char **argv);
>  int cmd__sha256(int argc, const char **argv);
>  int cmd__sigchain(int argc, const char **argv);
>  int cmd__strcmp_offset(int argc, const char **argv);
> @@ -62,8 +62,8 @@ int cmd__submodule_nested_repo_config(int argc, const char **argv);
>  int cmd__subprocess(int argc, const char **argv);
>  int cmd__trace2(int argc, const char **argv);
>  int cmd__urlmatch_normalization(int argc, const char **argv);
> -int cmd__xml_encode(int argc, const char **argv);
>  int cmd__wildmatch(int argc, const char **argv);
> +int cmd__xml_encode(int argc, const char **argv);
>  #ifdef GIT_WINDOWS_NATIVE
>  int cmd__windows_named_pipe(int argc, const char **argv);
>  #endif