Skip to content

Commit de3dec1

Browse files
committed
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 <[email protected]>
1 parent b0db798 commit de3dec1

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

Documentation/BreakingChanges.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ references.
178178
+
179179
These features will be removed.
180180

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+
181187
== Superseded features that will not be deprecated
182188

183189
Some features have gained newer replacements that aim to improve the design in

builtin/name-rev.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,11 @@ int cmd_name_rev(int argc,
567567
{
568568
struct mem_pool string_pool;
569569
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;
571575
struct name_ref_data data = { 0, 0, STRING_LIST_INIT_NODUP, STRING_LIST_INIT_NODUP };
572576
struct option opts[] = {
573577
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,
578582
N_("ignore refs matching <pattern>")),
579583
OPT_GROUP(""),
580584
OPT_BOOL(0, "all", &all, N_("list all commits reachable from all refs")),
585+
#ifndef WITH_BREAKING_CHANGES
581586
OPT_BOOL_F(0,
582587
"stdin",
583588
&transform_stdin,
584589
N_("deprecated: use --annotate-stdin instead"),
585590
PARSE_OPT_HIDDEN),
591+
#endif /* WITH_BREAKING_CHANGES */
586592
OPT_BOOL(0, "annotate-stdin", &annotate_stdin, N_("annotate text from stdin")),
587593
OPT_BOOL(0, "undefined", &allow_undefined, N_("allow to print `undefined` names (default)")),
588594
OPT_BOOL(0, "always", &always,
@@ -597,12 +603,14 @@ int cmd_name_rev(int argc,
597603
git_config(git_default_config, NULL);
598604
argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
599605

606+
#ifndef WITH_BREAKING_CHANGES
600607
if (transform_stdin) {
601608
warning("--stdin is deprecated. Please use --annotate-stdin instead, "
602609
"which is functionally equivalent.\n"
603610
"This option will be removed in a future release.");
604611
annotate_stdin = 1;
605612
}
613+
#endif
606614

607615
if (all + annotate_stdin + !!argc > 1) {
608616
error("Specify either a list, or --all, not both!");

t/t6120-describe.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,14 @@ test_expect_success 'name-rev --annotate-stdin' '
300300

301301
test_expect_success 'name-rev --stdin deprecated' '
302302
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
305311
'
306312

307313
test_expect_success 'describe --contains with the exact tags' '

0 commit comments

Comments
 (0)