Skip to content

Commit 8a17b25

Browse files
committed
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
2 parents 34a75cc + b9b10d3 commit 8a17b25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/read-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
210210
die("failed to unpack tree object %s", arg);
211211
stage++;
212212
}
213-
if (nr_trees == 0 && !read_empty)
213+
if (!nr_trees && !read_empty && !opts.merge)
214214
warning("read-tree: emptying the index with no arguments is deprecated; use --empty");
215215
else if (nr_trees > 0 && read_empty)
216216
die("passing trees as arguments contradicts --empty");

0 commit comments

Comments
 (0)