summaryrefslogtreecommitdiff
path: root/builtin-rm.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2007-11-03 12:23:13 +0100
committerJunio C Hamano <gitster@pobox.com>2007-11-05 22:47:57 -0800
commit271bb08735435b859464c22506ba512f003a4191 (patch)
tree56b023aea0d669eb73f7126a244e7f43305168a9 /builtin-rm.c
parent7d8ae93292e2cd862359f02879a0c954faf8afa8 (diff)
downloadgit-271bb08735435b859464c22506ba512f003a4191.tar.gz
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>
Diffstat (limited to 'builtin-rm.c')
-rw-r--r--builtin-rm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin-rm.c b/builtin-rm.c
index bca2bd9703..a3d25e6a57 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -155,6 +155,9 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
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++)