summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8b745e3)
raw | patch | inline | side by side (parent: 8b745e3)
author | Michael J Gruber <git@drmicha.warpmail.net> | |
Mon, 29 Sep 2008 16:49:52 +0000 (18:49 +0200) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 30 Sep 2008 21:30:00 +0000 (14:30 -0700) |
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>
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>
Documentation/git-prune.txt | patch | blob | history | |
builtin-prune.c | patch | blob | history |
index 54f1dab38de9e01d8452753ac6028875b91d5f6b..da6055d4b8cf78aff16fa553e684b0b3ed57138e 100644 (file)
SYNOPSIS
--------
-'git-prune' [-n] [--expire <expire>] [--] [<head>...]
+'git-prune' [-n] [-v] [--expire <expire>] [--] [<head>...]
DESCRIPTION
-----------
Do not remove anything; just report what it would
remove.
+-v::
+ Report all removed objects.
+
\--::
Do not interpret any more arguments as options.
diff --git a/builtin-prune.c b/builtin-prune.c
index 1663f8bdb1e27713bab6cf7a16ca15cfcfc1abef..7b4ec80e62997fe70f53c92380cd4d66e80d62a0 100644 (file)
--- a/builtin-prune.c
+++ b/builtin-prune.c
#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;
}
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()