summaryrefslogtreecommitdiff
path: root/builtin/prune.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-11-08 00:34:08 -0500
committerJunio C Hamano <gitster@pobox.com>2011-11-07 22:12:19 -0800
commitbf0a59b3872211eaa6d4cebb23ae110522458625 (patch)
tree014fea652ee94be204801857c3fc773b6762354b /builtin/prune.c
parentdc347195ccfbc87b6e445f5c31a5500e1df6c9b5 (diff)
downloadgit-bf0a59b3872211eaa6d4cebb23ae110522458625.tar.gz
prune: handle --progress/no-progress
And have "git gc" pass no-progress when quiet. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/prune.c')
-rw-r--r--builtin/prune.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/builtin/prune.c b/builtin/prune.c
index 6b39d3fdeb..58d7cb8324 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -15,6 +15,7 @@ static const char * const prune_usage[] = {
static int show_only;
static int verbose;
static unsigned long expire;
+static int show_progress = -1;
static int prune_tmp_object(const char *path, const char *filename)
{
@@ -125,10 +126,11 @@ static void remove_temporary_files(const char *path)
int cmd_prune(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
- struct progress *progress;
+ struct progress *progress = NULL;
const struct option options[] = {
OPT__DRY_RUN(&show_only, "do not remove, show only"),
OPT__VERBOSE(&verbose, "report pruned objects"),
+ OPT_BOOL(0, "progress", &show_progress, "show progress"),
OPT_DATE(0, "expire", &expire,
"expire objects older than <time>"),
OPT_END()
@@ -154,7 +156,12 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
else
die("unrecognized argument: %s", name);
}
- progress = start_progress_delay("Checking connectivity", 0, 0, 2);
+
+ if (show_progress == -1)
+ show_progress = isatty(2);
+ if (show_progress)
+ progress = start_progress_delay("Checking connectivity", 0, 0, 2);
+
mark_reachable_objects(&revs, 1, progress);
stop_progress(&progress);
prune_object_dir(get_object_directory());