git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-rm: add --quiet option to suppress "rm 'file'" messages

From
ELEric Lesh <eclesh@ucla.edu>
Date
Mar 26, 2007, 10:28 UTC
Message-ID
<1174904904.5662.8.camel@localhost>
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:
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
Previous: Johannes SchindelinNext: Junio C Hamano
Message 5 of 7 in “Re: [PATCH] Removed the printf("rm 'file'") from git-rm.”
  1. Junio C HamanoMar 25, 2007
  2. Anand KumriaMar 25, 2007
  3. Tilman SauerbeckMar 25, 2007
  4. Johannes SchindelinMar 25, 2007
  5. git-rm: add --quiet option to suppress "rm 'file'" messagesEric Lesh, Mar 26, 2007
  6. Junio C HamanoMar 26, 2007
  7. Martin WaitzMar 26, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.