1 #include "git-compat-util.h"
2 #include "environment.h"
4 #include "object-store-ll.h"
7 #include "prune-packed.h"
9 static struct progress
*progress
;
11 static int prune_subdir(unsigned int nr
, const char *path
, void *data
)
14 display_progress(progress
, nr
+ 1);
15 if (!(*opts
& PRUNE_PACKED_DRY_RUN
))
20 static int prune_object(const struct object_id
*oid
, const char *path
,
25 if (!has_object_pack(oid
))
28 if (*opts
& PRUNE_PACKED_DRY_RUN
)
29 printf("rm -f %s\n", path
);
35 void prune_packed_objects(int opts
)
37 if (opts
& PRUNE_PACKED_VERBOSE
)
38 progress
= start_delayed_progress(_("Removing duplicate objects"), 256);
40 for_each_loose_file_in_objdir(get_object_directory(),
41 prune_object
, NULL
, prune_subdir
, &opts
);
43 /* Ensure we show 100% before finishing progress */
44 display_progress(progress
, 256);
45 stop_progress(&progress
);