@@ -29,6 +29,7 @@ static int errors_found;
2929static int write_lost_and_found ;
3030static int verbose ;
3131static int show_progress = -1 ;
32+ static int show_dangling = 1 ;
3233#define ERROR_OBJECT 01
3334#define ERROR_REACHABLE 02
3435#define ERROR_PACK 04
@@ -221,8 +222,9 @@ static void check_unreachable_object(struct object *obj)
221222 * start looking at, for example.
222223 */
223224 if (!obj -> used ) {
224- printf ("dangling %s %s\n" , typename (obj -> type ),
225- sha1_to_hex (obj -> sha1 ));
225+ if (show_dangling )
226+ printf ("dangling %s %s\n" , typename (obj -> type ),
227+ sha1_to_hex (obj -> sha1 ));
226228 if (write_lost_and_found ) {
227229 char * filename = git_path ("lost-found/%s/%s" ,
228230 obj -> type == OBJ_COMMIT ? "commit" : "other" ,
@@ -614,6 +616,7 @@ static char const * const fsck_usage[] = {
614616static struct option fsck_opts [] = {
615617 OPT__VERBOSE (& verbose , "be verbose" ),
616618 OPT_BOOLEAN (0 , "unreachable" , & show_unreachable , "show unreachable objects" ),
619+ OPT_BOOL (0 , "dangling" , & show_dangling , "show dangling objects" ),
617620 OPT_BOOLEAN (0 , "tags" , & show_tags , "report tags" ),
618621 OPT_BOOLEAN (0 , "root" , & show_root , "report root nodes" ),
619622 OPT_BOOLEAN (0 , "cache" , & keep_cache_objects , "make index objects head nodes" ),
0 commit comments