]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-rm.c
Use proper object allocators for unknown object nodes too
[git.git] / builtin-rm.c
index 8a0738f83dd31a847bf486ddb3aefef94af5e049..b77b058e38c9a2b148f3c4deffa13945ee7daef6 100644 (file)
@@ -10,7 +10,7 @@
 #include "tree-walk.h"
 
 static const char builtin_rm_usage[] =
-"git-rm [-f] [-n] [-r] [--cached] [--] <file>...";
+"git-rm [-f] [-n] [-r] [--cached] [--quiet] [--] <file>...";
 
 static struct {
        int nr, alloc;
@@ -104,7 +104,7 @@ static struct lock_file lock_file;
 int cmd_rm(int argc, const char **argv, const char *prefix)
 {
        int i, newfd;
-       int show_only = 0, force = 0, index_only = 0, recursive = 0;
+       int show_only = 0, force = 0, index_only = 0, recursive = 0, quiet = 0;
        const char **pathspec;
        char *seen;
 
@@ -132,6 +132,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
                        force = 1;
                else if (!strcmp(arg, "-r"))
                        recursive = 1;
+               else if (!strcmp(arg, "--quiet"))
+                       quiet = 1;
                else
                        usage(builtin_rm_usage);
        }
@@ -168,7 +170,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
         * must match; but the file can already been removed, since
         * this sequence is a natural "novice" way:
         *
-        *      rm F; git fm F
+        *      rm F; git rm F
         *
         * Further, if HEAD commit exists, "diff-index --cached" must
         * report no changes unless forced.
@@ -187,7 +189,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
         */
        for (i = 0; i < list.nr; i++) {
                const char *path = list.name[i];
-               printf("rm '%s'\n", path);
+               if (!quiet)
+                       printf("rm '%s'\n", path);
 
                if (remove_file_from_cache(path))
                        die("git-rm: unable to remove %s", path);