Don't always require working tree for git-rm

This allows to do git rm --cached -r directory, instead of
git ls-files -z directory | git update-index --remove -z --stdin.
This can be particularly useful for git-filter-branch users.

Signed-off-by: Mike Hommey <mh@glandium.org>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/builtin-rm.c b/builtin-rm.c
index bca2bd9..a3d25e6 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -155,6 +155,9 @@
 	if (!argc)
 		usage_with_options(builtin_rm_usage, builtin_rm_options);
 
+	if (!index_only)
+		setup_work_tree();
+
 	pathspec = get_pathspec(prefix, argv);
 	seen = NULL;
 	for (i = 0; pathspec[i] ; i++)