[PATCH] git-rm: add --quiet option to suppress "rm 'file'" messages
Signed-off-by: Eric Lesh <eclesh@ucla.edu>
---
On Sun, 2007-03-25 at 23:36 +0200, Johannes Schindelin wrote:
Show 6 quoted lines
> > Too bad, I find it rather annoying and irritating.
>
> Why not do the common thing, and add a "--quiet" option? You can even add
> a config variable to enable it by default (for git-rm). It's not like
> git-rm is performance critical...
>
Is something like this right?
builtin-rm.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/builtin-rm.c b/builtin-rm.c
index 00dbe39..d193fb0 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -114,7 +114,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;
@@ -142,6 +142,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, "-q") || !strcmp(arg, "--quiet"))
+ quiet = 1;
else
usage(builtin_rm_usage);
}
@@ -197,7 +199,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);
--
1.5.1-rc1.GIT