{"thread":{"id":"15707","subject":"[PATCH] make prune report removed objects on -v","startedAt":"2008-09-29T16:49:52Z","lastAt":"2008-09-29T16:49:52Z","messageCount":1,"participants":["Michael J Gruber"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"91862","messageId":"1222706992-15531-1-git-send-email-git@drmicha.warpmail.net","threadId":"15707","inReplyTo":null,"subject":"[PATCH] make prune report removed objects on -v","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2008-09-29T16:49:52Z","receivedAt":"2008-09-29T16:49:52Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"This adds an option \"-v\" which makes \"git prune\" more verbose:\nIt outputs all removed objects while removing them.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n Documentation/git-prune.txt |    5 ++++-\n builtin-prune.c             |   10 +++++++---\n 2 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-prune.txt b/Documentation/git-prune.txt\nindex 54f1dab..da6055d 100644\n--- a/Documentation/git-prune.txt\n+++ b/Documentation/git-prune.txt\n@@ -8,7 +8,7 @@ git-prune - Prune all unreachable objects from the object database\n \n SYNOPSIS\n --------\n-'git-prune' [-n] [--expire <expire>] [--] [<head>...]\n+'git-prune' [-n] [-v] [--expire <expire>] [--] [<head>...]\n \n DESCRIPTION\n -----------\n@@ -34,6 +34,9 @@ OPTIONS\n \tDo not remove anything; just report what it would\n \tremove.\n \n+-v::\n+\tReport all removed objects.\n+\n \\--::\n \tDo not interpret any more arguments as options.\n \ndiff --git a/builtin-prune.c b/builtin-prune.c\nindex 1663f8b..7b4ec80 100644\n--- a/builtin-prune.c\n+++ b/builtin-prune.c\n@@ -7,10 +7,11 @@\n #include \"parse-options.h\"\n \n static const char * const prune_usage[] = {\n-\t\"git prune [-n] [--expire <time>] [--] [<head>...]\",\n+\t\"git prune [-n] [-v] [--expire <time>] [--] [<head>...]\",\n \tNULL\n };\n static int show_only;\n+static int verbose;\n static unsigned long expire;\n \n static int prune_tmp_object(const char *path, const char *filename)\n@@ -39,11 +40,12 @@ static int prune_object(char *path, const char *filename, const unsigned char *s\n \t\tif (st.st_mtime > expire)\n \t\t\treturn 0;\n \t}\n-\tif (show_only) {\n+\tif (show_only || verbose) {\n \t\tenum object_type type = sha1_object_info(sha1, NULL);\n \t\tprintf(\"%s %s\\n\", sha1_to_hex(sha1),\n \t\t       (type > 0) ? typename(type) : \"unknown\");\n-\t} else\n+\t}\n+\tif (!show_only)\n \t\tunlink(fullpath);\n \treturn 0;\n }\n@@ -135,6 +137,8 @@ int cmd_prune(int argc, const char **argv, const char *prefix)\n \tconst struct option options[] = {\n \t\tOPT_BOOLEAN('n', NULL, &show_only,\n \t\t\t    \"do not remove, show only\"),\n+\t\tOPT_BOOLEAN('v', NULL, &verbose,\n+\t\t\t\"report pruned objects\"),\n \t\tOPT_DATE(0, \"expire\", &expire,\n \t\t\t \"expire objects older than <time>\"),\n \t\tOPT_END()\n-- \n1.6.0.2.287.g3791f\n"}]}