[PATCH 5/9] git rm ":" is like specifying nothing
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 10, 2011, 05:51 UTC
- Message-ID
- <1305006678-4051-6-git-send-email-gitster@pobox.com>
- In-Reply-To
- <1305006678-4051-1-git-send-email-gitster@pobox.com>
"git cmd :" should be exactly the same as running "git cmd" from the root level of the working tree. Do not decide solely on the value of argc (i.e. remaining parameters after options and revs are parsed) to see if the user limited the operation with paths.
Signed-off-by: Junio C Hamano <gitster@pobox.com> --- builtin/rm.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/builtin/rm.c b/builtin/rm.c index ff491d7..c31f915 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -162,11 +162,13 @@ int cmd_rm(int argc, const char **argv, const char *prefix) die("index file corrupt"); pathspec = get_pathspec(prefix, argv); + if (!pathspec) + die("removing nothing?"); refresh_index(&the_index, REFRESH_QUIET, pathspec, NULL, NULL); seen = NULL; for (i = 0; pathspec[i] ; i++) - /* nothing */; + ; /* nothing */ seen = xcalloc(i, 1); for (i = 0; i < active_nr; i++) {
-- 1.7.5.1.290.g1b565