3 #include "object-store.h"
6 #include "prune-packed.h"
8 static struct progress
*progress
;
10 static int prune_subdir(unsigned int nr
, const char *path
, void *data
)
13 display_progress(progress
, nr
+ 1);
14 if (!(*opts
& PRUNE_PACKED_DRY_RUN
))
19 static int prune_object(const struct object_id
*oid
, const char *path
,
24 if (!has_object_pack(oid
))
27 if (*opts
& PRUNE_PACKED_DRY_RUN
)
28 printf("rm -f %s\n", path
);
34 void prune_packed_objects(int opts
)
36 if (opts
& PRUNE_PACKED_VERBOSE
)
37 progress
= start_delayed_progress(_("Removing duplicate objects"), 256);
39 for_each_loose_file_in_objdir(get_object_directory(),
40 prune_object
, NULL
, prune_subdir
, &opts
);
42 /* Ensure we show 100% before finishing progress */
43 display_progress(progress
, 256);
44 stop_progress(&progress
);