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>
This commit is contained in:
parent
7d8ae93292
commit
271bb08735
@ -155,6 +155,9 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
|
|||||||
if (!argc)
|
if (!argc)
|
||||||
usage_with_options(builtin_rm_usage, builtin_rm_options);
|
usage_with_options(builtin_rm_usage, builtin_rm_options);
|
||||||
|
|
||||||
|
if (!index_only)
|
||||||
|
setup_work_tree();
|
||||||
|
|
||||||
pathspec = get_pathspec(prefix, argv);
|
pathspec = get_pathspec(prefix, argv);
|
||||||
seen = NULL;
|
seen = NULL;
|
||||||
for (i = 0; pathspec[i] ; i++)
|
for (i = 0; pathspec[i] ; i++)
|
||||||
|
2
git.c
2
git.c
@ -340,7 +340,7 @@ static void handle_internal_command(int argc, const char **argv)
|
|||||||
{ "rev-list", cmd_rev_list, RUN_SETUP },
|
{ "rev-list", cmd_rev_list, RUN_SETUP },
|
||||||
{ "rev-parse", cmd_rev_parse, RUN_SETUP },
|
{ "rev-parse", cmd_rev_parse, RUN_SETUP },
|
||||||
{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
|
{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
|
||||||
{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
|
{ "rm", cmd_rm, RUN_SETUP },
|
||||||
{ "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },
|
{ "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },
|
||||||
{ "shortlog", cmd_shortlog, RUN_SETUP | USE_PAGER },
|
{ "shortlog", cmd_shortlog, RUN_SETUP | USE_PAGER },
|
||||||
{ "show-branch", cmd_show_branch, RUN_SETUP },
|
{ "show-branch", cmd_show_branch, RUN_SETUP },
|
||||||
|
Loading…
Reference in New Issue
Block a user