fb1bb965 ("read-tree: deprecate syntax without tree-ish args", 2010-09-10) wanted to deprecate "git read-tree" without any tree, which used to be the way to empty the index, and encourage use of "git read-tree --empty" instead. However, when used with "-m", "--empty" does not make any sense, either, simply because merging 0 trees will result in a different error anyway. Omit the deprecation warning and let the code to emit real error message diagnose the error. Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- Junio C Hamano <gitster@xxxxxxxxx> writes: > Jean-Noel Avila <jn.avila@xxxxxxx> writes: > >> "git read-tree -m" requires a tree argument to name the tree to be >> merged in. Git uses a cutesy error message to say so and why: >> >> $ git read-tree -m >> warning: read-tree: emptying the index with no arguments is >> deprecated; use --empty >> fatal: just how do you expect me to merge 0 trees? >> $ git read-tree -m --empty >> fatal: just how do you expect me to merge 0 trees? > > This shows another issue. The "emptying ... is deprecated" message > shouldn't be given when -m is present. > > I am not saying that that needs to be fixed by you and/or as a part > of this patch. Just something I noticed while reviewing the patch. builtin/read-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 23e212ee8c..284de743c3 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -210,7 +210,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) die("failed to unpack tree object %s", arg); stage++; } - if (nr_trees == 0 && !read_empty) + if (!nr_trees && !read_empty && !opts.merge) warning("read-tree: emptying the index with no arguments is deprecated; use --empty"); else if (nr_trees > 0 && read_empty) die("passing trees as arguments contradicts --empty"); -- 2.13.0-336-gf73534b083