aboutsummaryrefslogtreecommitdiff
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-02-28 14:55:39 -0800
committerJunio C Hamano <gitster@pobox.com>2012-02-28 14:55:39 -0800
commitc6a13b2c86b71cb25011094ff2dee3d7769991a2 (patch)
tree79877bce418a0b108d847a1c49779194b97c5345 /builtin/fsck.c
parentba998d33e22d6fce4445af5834dc227609672501 (diff)
downloadgit-c6a13b2c86b71cb25011094ff2dee3d7769991a2.tar.gz
git-c6a13b2c86b71cb25011094ff2dee3d7769991a2.tar.xz
fsck: --no-dangling omits "dangling object" information
The default output from "fsck" is often overwhelmed by informational message on dangling objects, especially if you do not repack often, and a real error can easily be buried. Add "--no-dangling" option to omit them, and update the user manual to demonstrate its use. Based on a patch by Clemens Buchacher, but reverted the part to change the default to --no-dangling, which is unsuitable for the first patch. The usual three-step procedure to break the backward compatibility over time needs to happen on top of this, if we were to go in that direction. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 8c479a791..67eb553c7 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -29,6 +29,7 @@ static int errors_found;
static int write_lost_and_found;
static int verbose;
static int show_progress = -1;
+static int show_dangling = 1;
#define ERROR_OBJECT 01
#define ERROR_REACHABLE 02
#define ERROR_PACK 04
@@ -221,8 +222,9 @@ static void check_unreachable_object(struct object *obj)
* start looking at, for example.
*/
if (!obj->used) {
- printf("dangling %s %s\n", typename(obj->type),
- sha1_to_hex(obj->sha1));
+ if (show_dangling)
+ printf("dangling %s %s\n", typename(obj->type),
+ sha1_to_hex(obj->sha1));
if (write_lost_and_found) {
char *filename = git_path("lost-found/%s/%s",
obj->type == OBJ_COMMIT ? "commit" : "other",
@@ -614,6 +616,7 @@ static char const * const fsck_usage[] = {
static struct option fsck_opts[] = {
OPT__VERBOSE(&verbose, "be verbose"),
OPT_BOOLEAN(0, "unreachable", &show_unreachable, "show unreachable objects"),
+ OPT_BOOL(0, "dangling", &show_dangling, "show dangling objects"),
OPT_BOOLEAN(0, "tags", &show_tags, "report tags"),
OPT_BOOLEAN(0, "root", &show_root, "report root nodes"),
OPT_BOOLEAN(0, "cache", &keep_cache_objects, "make index objects head nodes"),