From: Johannes Sixt Date: Tue, 15 Dec 2009 08:43:38 GMT Subject: [PATCH 2/2] read-tree: at least one tree-ish argument is required Message-ID: <4B274C3A.4060808@viscovery.net> In-Reply-To: <4B274BDE.8000504@viscovery.net> From: Johannes Sixt Previously, it was possible to run read-tree without any arguments, whereupon it purged the index! Signed-off-by: Johannes Sixt --- Discovered by typing git ..daab02 with help.autocorrect > 0 :-) -- Hannes builtin-read-tree.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/builtin-read-tree.c b/builtin-read-tree.c index 50413ca..31623b9 100644 --- a/builtin-read-tree.c +++ b/builtin-read-tree.c @@ -125,6 +125,9 @@ int cmd_read_tree(int argc, const char **argv, stage = opts.merge = 1; } + if (argc == 0) + usage_with_options(read_tree_usage, read_tree_options); + for (i = 0; i < argc; i++) { const char *arg = argv[i]; -- 1.6.6.rc1.46.g1635