1 #define USE_THE_REPOSITORY_VARIABLE
3 #include "git-compat-util.h"
5 #include "object-store-ll.h"
8 #include "prune-packed.h"
9 #include "repository.h"
11 static struct progress
*progress
;
13 static int prune_subdir(unsigned int nr
, const char *path
, void *data
)
16 display_progress(progress
, nr
+ 1);
17 if (!(*opts
& PRUNE_PACKED_DRY_RUN
))
22 static int prune_object(const struct object_id
*oid
, const char *path
,
27 if (!has_object_pack(oid
))
30 if (*opts
& PRUNE_PACKED_DRY_RUN
)
31 printf("rm -f %s\n", path
);
37 void prune_packed_objects(int opts
)
39 if (opts
& PRUNE_PACKED_VERBOSE
)
40 progress
= start_delayed_progress(_("Removing duplicate objects"), 256);
42 for_each_loose_file_in_objdir(repo_get_object_directory(the_repository
),
43 prune_object
, NULL
, prune_subdir
, &opts
);
45 /* Ensure we show 100% before finishing progress */
46 display_progress(progress
, 256);
47 stop_progress(&progress
);