1 #include "object-store.h"
4 #include "prune-packed.h"
6 static struct progress
*progress
;
8 static int prune_subdir(unsigned int nr
, const char *path
, void *data
)
11 display_progress(progress
, nr
+ 1);
12 if (!(*opts
& PRUNE_PACKED_DRY_RUN
))
17 static int prune_object(const struct object_id
*oid
, const char *path
,
22 if (!has_object_pack(oid
))
25 if (*opts
& PRUNE_PACKED_DRY_RUN
)
26 printf("rm -f %s\n", path
);
32 void prune_packed_objects(int opts
)
34 if (opts
& PRUNE_PACKED_VERBOSE
)
35 progress
= start_delayed_progress(_("Removing duplicate objects"), 256);
37 for_each_loose_file_in_objdir(get_object_directory(),
38 prune_object
, NULL
, prune_subdir
, &opts
);
40 /* Ensure we show 100% before finishing progress */
41 display_progress(progress
, 256);
42 stop_progress(&progress
);