Skip to content

Commit b9b10d3

Browse files
committed
read-tree: "read-tree -m --empty" does not make sense
fb1bb96 ("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 <[email protected]>
1 parent 840ed14 commit b9b10d3

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
@@ -181,7 +181,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
181181
die("failed to unpack tree object %s", arg);
182182
stage++;
183183
}
184-
if (nr_trees == 0 && !read_empty)
184+
if (!nr_trees && !read_empty && !opts.merge)
185185
warning("read-tree: emptying the index with no arguments is deprecated; use --empty");
186186
else if (nr_trees > 0 && read_empty)
187187
die("passing trees as arguments contradicts --empty");

0 commit comments

Comments
 (0)