summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-06-04 10:21:00 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-06-04 10:21:00 +0900
commit8a17b259e2c9137c1653523e00a988cb3cee3a1f (patch)
tree971cb91c93753f1c0a88b20a5ac1eb0a8f840074
parentMerge branch 'jc/apply-fix-mismerge' into maint (diff)
parentread-tree: "read-tree -m --empty" does not make sense (diff)
downloadtgif-8a17b259e2c9137c1653523e00a988cb3cee3a1f.tar.xz
Merge branch 'jc/read-tree-empty-with-m' into maint
"git read-tree -m" (no tree-ish) gave a nonsense suggestion "use --empty if you want to clear the index". With "-m", such a request will still fail anyway, as you'd need to name at least one tree-ish to be merged. * jc/read-tree-empty-with-m: read-tree: "read-tree -m --empty" does not make sense
-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 3834425679..a52a9e11bb 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");