git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Lesh <eclesh@ucla.edu>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Tilman Sauerbeck <tilman@code-monkey.de>, git@vger.kernel.org
Subject: [PATCH] git-rm: add --quiet option to suppress "rm 'file'" messages
Date: Mon, 26 Mar 2007 03:28:24 -0700	[thread overview]
Message-ID: <1174904904.5662.8.camel@localhost> (raw)
In-Reply-To: <Pine.LNX.4.63.0703252335280.4045@wbgn013.biozentrum.uni-wuerzburg.de>

Signed-off-by: Eric Lesh <eclesh@ucla.edu>

---

On Sun, 2007-03-25 at 23:36 +0200, Johannes Schindelin wrote:
> > 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

  reply	other threads:[~2007-03-26 10:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <11747590062554-git-send-email-tilman@code-monkey.de>
2007-03-25  6:22 ` [PATCH] Removed the printf("rm 'file'") from git-rm Junio C Hamano
2007-03-25 16:38   ` Anand Kumria
2007-03-25 21:04   ` Tilman Sauerbeck
2007-03-25 21:36     ` Johannes Schindelin
2007-03-26 10:28       ` Eric Lesh [this message]
2007-03-26 22:56         ` [PATCH] git-rm: add --quiet option to suppress "rm 'file'" messages Junio C Hamano
2007-03-26 22:13       ` [PATCH] Removed the printf("rm 'file'") from git-rm Martin Waitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1174904904.5662.8.camel@localhost \
    --to=eclesh@ucla.edu \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=tilman@code-monkey.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).