diff options
author | Michael J Gruber <git@drmicha.warpmail.net> | 2008-09-29 18:49:52 +0200 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-09-30 14:30:00 -0700 |
commit | b35ddf41eeee1465c9c5a34357664d22b929b79a (patch) | |
tree | 4ebf485a4e4ca606423ae77ed5d88b46e3042528 /builtin-prune.c | |
parent | 8b745e3ffdabe6ef110dc064af46b0ba993941e0 (diff) | |
download | git-b35ddf41eeee1465c9c5a34357664d22b929b79a.tar.gz |
make prune report removed objects on -v
This adds an option "-v" which makes "git prune" more verbose:
It outputs all removed objects while removing them.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'builtin-prune.c')
-rw-r--r-- | builtin-prune.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/builtin-prune.c b/builtin-prune.c index 1663f8bdb1..7b4ec80e62 100644 --- a/builtin-prune.c +++ b/builtin-prune.c @@ -7,10 +7,11 @@ #include "parse-options.h" static const char * const prune_usage[] = { - "git prune [-n] [--expire <time>] [--] [<head>...]", + "git prune [-n] [-v] [--expire <time>] [--] [<head>...]", NULL }; static int show_only; +static int verbose; static unsigned long expire; static int prune_tmp_object(const char *path, const char *filename) @@ -39,11 +40,12 @@ static int prune_object(char *path, const char *filename, const unsigned char *s if (st.st_mtime > expire) return 0; } - if (show_only) { + if (show_only || verbose) { enum object_type type = sha1_object_info(sha1, NULL); printf("%s %s\n", sha1_to_hex(sha1), (type > 0) ? typename(type) : "unknown"); - } else + } + if (!show_only) unlink(fullpath); return 0; } @@ -135,6 +137,8 @@ int cmd_prune(int argc, const char **argv, const char *prefix) const struct option options[] = { OPT_BOOLEAN('n', NULL, &show_only, "do not remove, show only"), + OPT_BOOLEAN('v', NULL, &verbose, + "report pruned objects"), OPT_DATE(0, "expire", &expire, "expire objects older than <time>"), OPT_END() |