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

From: Junio C Hamano <[email-masked]>
Date: Wed, 05 Jan 2022 12:07:06 -0800

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

> +	altogether.
> ++
> +For example:
> ++
> +--
> +	$ cat sample.txt
> +
> +	An abbreviated revision 2ae0a9cb82 will not be substituted.
> +	The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907,
> +	while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
> +
> +	$ git name-rev --annotate-stdin <sample.txt
> +
> +	An abbreviated revision 2ae0a9cb82 will not be substituted.
> +	The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907 (master),
> +	while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
> +
> +	$ git name-rev --name-only --annotate-stdin <sample.txt
> +
> +	An abbreviated revision 2ae0a9cb82 will not be substituted.
> +	The full name after substitution is master,
> +	while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
> +--

I compared the output from the earlier ones with this one; the way
the displayed sample was shown in the previous rounds looked better,
at least in HTML pages.  The earlier ones used "listingblock" in
which the sample is contained in a <pre>formatted <code> block, but
this one ends up in a series of one-<div>-per-paragraph.

> -	if (transform_stdin) {
> -		char buffer[2048];
> +	if (annotate_stdin) {
> +		struct strbuf sb = STRBUF_INIT;

This will break the compilation at this step.