# [PATCH] gc: Add --quiet option

2 messages from 2008-02-29 to 2008-03-01. Participants: Frank Lichtenheld, Junio C Hamano.
Thread: https://gitlist.dev/t/12388

## Frank Lichtenheld, 2008-02-29 21:53

Subject: [PATCH] gc: Add --quiet option
Message-ID: <1204322019-17788-1-git-send-email-frank@lichtenheld.de>
URL: https://gitlist.dev/e/1204322019-17788-1-git-send-email-frank%40lichtenheld.de

```
Pass -q option to git-repack.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
 Documentation/git-gc.txt |    5 ++++-
 builtin-gc.c             |    5 +++++
 2 files changed, 9 insertions(+), 1 deletions(-)

I've decided to support -q since all other git commands that support --quiet
seem to support it, and many only support -q, but not --quiet.
It is currently not documented, though.

diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 4b2dfef..310710a 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -8,7 +8,7 @@ git-gc - Cleanup unnecessary files and optimize the local repository
 
 SYNOPSIS
 --------
-'git-gc' [--prune] [--aggressive] [--auto]
+'git-gc' [--prune] [--aggressive] [--auto] [--quiet]
 
 DESCRIPTION
 -----------
@@ -49,6 +49,9 @@ OPTIONS
 	required; if not, it exits without performing any work.
 	Some git commands run `git gc --auto` after performing
 	operations that could create many loose objects.
+
+--quiet::
+	Suppress all progress reports.
 +
 Housekeeping is required if there are too many loose objects or
 too many packs in the repository. If the number of loose objects
diff --git a/builtin-gc.c b/builtin-gc.c
index ad4a75e..3a42986 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -172,12 +172,14 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 	int prune = 0;
 	int aggressive = 0;
 	int auto_gc = 0;
+	int quiet = 0;
 	char buf[80];
 
 	struct option builtin_gc_options[] = {
 		OPT_BOOLEAN(0, "prune", &prune, "prune unreferenced objects"),
 		OPT_BOOLEAN(0, "aggressive", &aggressive, "be more thorough (increased runtime)"),
 		OPT_BOOLEAN(0, "auto", &auto_gc, "enable auto-gc mode"),
+		OPT_BOOLEAN('q', "quiet", &quiet, "suppress progress reports"),
 		OPT_END()
 	};
 
@@ -197,6 +199,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 			append_option(argv_repack, buf, MAX_ADD);
 		}
 	}
+	if (quiet) {
+		append_option(argv_repack, "-q", MAX_ADD);
+	}
 
 	if (auto_gc) {
 		/*
-- 
1.5.4.3


```

## Junio C Hamano, 2008-03-01 20:24

Subject: Re: [PATCH] gc: Add --quiet option
Message-ID: <7v4pbqyyy0.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4pbqyyy0.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <1204322019-17788-1-git-send-email-frank@lichtenheld.de>

```
Frank Lichtenheld <frank@lichtenheld.de> writes:

> @@ -49,6 +49,9 @@ OPTIONS
>  	required; if not, it exits without performing any work.
>  	Some git commands run `git gc --auto` after performing
>  	operations that could create many loose objects.
> +
> +--quiet::
> +	Suppress all progress reports.
>  +
>  Housekeeping is required if there are too many loose objects or
>  too many packs in the repository. If the number of loose objects

Read the surrounding text again.  "Housekeeping is..." is talking about
the --auto option.

I'll move the description of --quiet a bit down.

> @@ -197,6 +199,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
>  			append_option(argv_repack, buf, MAX_ADD);
>  		}
>  	}
> +	if (quiet) {
> +		append_option(argv_repack, "-q", MAX_ADD);
> +	}

No { } around a single statement.

No need to resend, as I've already munged your patch and applied.

Thanks.

```
