summaryrefslogtreecommitdiff
path: root/builtin/read-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-11 04:31:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-11 04:42:17 (GMT)
commitb9b10d36816b8c7276bb83eb08fdbb59f68ef99b (patch)
treec6f0a165bb7a66b646907abe9a0b5aadb3a796de /builtin/read-tree.c
parent840ed141983718e0c5518a325534a5656797132a (diff)
downloadgit-b9b10d36816b8c7276bb83eb08fdbb59f68ef99b.zip
git-b9b10d36816b8c7276bb83eb08fdbb59f68ef99b.tar.gz
git-b9b10d36816b8c7276bb83eb08fdbb59f68ef99b.tar.bz2
read-tree: "read-tree -m --empty" does not make sense
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@pobox.com>
Diffstat (limited to 'builtin/read-tree.c')
-rw-r--r--builtin/read-tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 8c693e7..ce5265d 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -181,7 +181,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");