name-rev: remove "--stdin" support

As part of Git 3.0, remove the hidden synonym for "--annotate-stdin" for real. As this does not change the fact that it used to be called "--stdin" in older version of Git, keep that passage in the documentation for "--annotate-stdin". Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Mar 11, 2025 at 14:25 UTC de3dec118784e82855ba3635726ccff09b596bec
3 files changed +23 -3
Documentation/BreakingChanges.adoc
+6
@@ -178,6 +178,12 @@ references.
178 +
179 These features will be removed.
180
181 +* Support for "--stdin" option in the "name-rev" command was
182 + deprecated (and hidden from the documentation) in the Git 2.40
183 + timeframe, in preference to its synonym "--annotate-stdin". Git 3.0
184 + removes the support for "--stdin" altogether.
185 +
186 +
187 == Superseded features that will not be deprecated
188
189 Some features have gained newer replacements that aim to improve the design in
builtin/name-rev.c
+9 -1
@@ -567,7 +567,11 @@ int cmd_name_rev(int argc,
567 {
568 struct mem_pool string_pool;
569 struct object_array revs = OBJECT_ARRAY_INIT;
570 - int all = 0, annotate_stdin = 0, transform_stdin = 0, allow_undefined = 1, always = 0, peel_tag = 0;
570 +
571 +#ifndef WITH_BREAKING_CHANGES
572 + int transform_stdin = 0;
573 +#endif
574 + int all = 0, annotate_stdin = 0, allow_undefined = 1, always = 0, peel_tag = 0;
575 struct name_ref_data data = { 0, 0, STRING_LIST_INIT_NODUP, STRING_LIST_INIT_NODUP };
576 struct option opts[] = {
577 OPT_BOOL(0, "name-only", &data.name_only, N_("print only ref-based names (no object names)")),
@@ -578,11 +582,13 @@ int cmd_name_rev(int argc,
582 N_("ignore refs matching <pattern>")),
583 OPT_GROUP(""),
584 OPT_BOOL(0, "all", &all, N_("list all commits reachable from all refs")),
585 +#ifndef WITH_BREAKING_CHANGES
586 OPT_BOOL_F(0,
587 "stdin",
588 &transform_stdin,
589 N_("deprecated: use --annotate-stdin instead"),
590 PARSE_OPT_HIDDEN),
591 +#endif /* WITH_BREAKING_CHANGES */
592 OPT_BOOL(0, "annotate-stdin", &annotate_stdin, N_("annotate text from stdin")),
593 OPT_BOOL(0, "undefined", &allow_undefined, N_("allow to print `undefined` names (default)")),
594 OPT_BOOL(0, "always", &always,
@@ -597,12 +603,14 @@ int cmd_name_rev(int argc,
603 git_config(git_default_config, NULL);
604 argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
605
606 +#ifndef WITH_BREAKING_CHANGES
607 if (transform_stdin) {
608 warning("--stdin is deprecated. Please use --annotate-stdin instead, "
609 "which is functionally equivalent.\n"
610 "This option will be removed in a future release.");
611 annotate_stdin = 1;
612 }
613 +#endif
614
615 if (all + annotate_stdin + !!argc > 1) {
616 error("Specify either a list, or --all, not both!");
t/t6120-describe.sh
+8 -2
@@ -300,8 +300,14 @@ test_expect_success 'name-rev --annotate-stdin' '
300
301 test_expect_success 'name-rev --stdin deprecated' '
302 git rev-list --all >list &&
303 - git name-rev --stdin <list 2>actual &&
304 - test_grep "warning: --stdin is deprecated" actual
303 + if ! test_have_prereq WITH_BREAKING_CHANGES
304 + then
305 + git name-rev --stdin <list 2>actual &&
306 + test_grep "warning: --stdin is deprecated" actual
307 + else
308 + test_must_fail git name-rev --stdin <list 2>actual &&
309 + test_grep "unknown option .stdin." actual
310 + fi
311 '
312
313 test_expect_success 'describe --contains with the exact tags' '