Subject: Re: [PATCH v2 1/2] name-rev: deprecate --stdin in favor of --annotate-text

From: Junio C Hamano <[email-masked]>
Date: Thu, 30 Dec 2021 14:36:47 -0800

"John Cai via GitGitGadget" <[email-masked]> writes:

> From: John Cai <[email-masked]>
>
> Introduce a --annotate-text that is functionally equivalent of --stdin.
> --stdin does not behave as --stdin in other subcommands, such as
> pack-objects whereby it takes one argument per line. Since --stdin can
> be a confusing and misleading name, rename it to --annotate-text.
>
> This change adds a warning to --stdin warning that it will be removed in
> the future.

The above (including the title) uses --annotate-TEXT; the
documentation and the code seems to use --annotate-STDIN.

>
> Signed-off-by: "John Cai" <[email-masked]>
> ---
>  Documentation/git-name-rev.txt | 29 ++++++++++++++++++++++++++++-
>  builtin/name-rev.c             | 19 ++++++++++++++-----
>  2 files changed, 42 insertions(+), 6 deletions(-)

We probably would want to fix existing tests that use --stdin for
its originally intended purpose to use its new spelling instead, and
a single new test to ensure that use of --stdin gives a warning as
expected.

> @@ -613,8 +622,8 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
>  	for_each_ref(name_ref, &data);
>  	name_tips();
>  
> -	if (transform_stdin) {
> -		char buffer[2048];
> +	if (annotate_stdin) {
> +		struct strbuf sb = STRBUF_INIT;
>  
>  		while (!feof(stdin)) {
>  			char *p = fgets(buffer, sizeof(buffer), stdin);

This block probably would not compile well.