Re: [PATCH v2 1/2] name-rev: deprecate --stdin in favor of --annotate-text
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 30, 2021, 22:36 UTC
- Message-ID
- <xmqqsfu9oh34.fsf@gitster.g>
- In-Reply-To
- <e8063284b4d0d410d1ee8337c60f5ce3b48efb11.1640759021.git.gitgitgadget@gmail.com>
"John Cai via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 9 quoted lines
> From: John Cai <johncai86@gmail.com> > > 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.
Show 6 quoted lines
> > Signed-off-by: "John Cai" <johncai86@gmail.com> > --- > 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.
Show 11 quoted lines
> @@ -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.