commit - 828ad4330c114d7c18c2d02c0f18675aeff78cbfc59578675fa48fbd79161e7c
commit + 808577a26fca1363896c388b85619dfdae201cc94190fa5fc1da03e48c8631e2
blob - 9428182ffecdb22fb3013026787ba3715a620b387c76da30e31692900cf8b4cf
blob + 6515fa7d69cb628096b7820eece38d4dad0fe41023c093c556980ee9161b7378
--- gotadmin/gotadmin.c
+++ gotadmin/gotadmin.c
struct got_cleanup_progress_arg {
int last_nloose;
- int last_ncommits;
int last_npurged;
int last_nredundant;
int verbosity;
};
static const struct got_error *
-cleanup_progress(void *arg, int ncommits, int nloose, int npurged,
- int nredundant)
+cleanup_progress(void *arg, int nloose, int npurged, int nredundant)
{
struct got_cleanup_progress_arg *a = arg;
- int print_loose = 0, print_commits = 0, print_purged = 0;
+ int print_loose = 0, print_purged = 0;
int print_redundant = 0;
- if (a->last_ncommits != ncommits) {
- print_commits = 1;
- a->last_ncommits = ncommits;
- }
if (a->last_nloose != nloose) {
- print_commits = 1;
print_loose = 1;
a->last_nloose = nloose;
}
if (a->last_npurged != npurged) {
- print_commits = 1;
print_loose = 1;
print_purged = 1;
a->last_npurged = npurged;
}
if (a->last_nredundant != nredundant) {
- print_commits = 1;
print_loose = 1;
print_purged = 1;
print_redundant = 1;
if (a->verbosity < 0)
return NULL;
- if (print_loose || print_commits || print_purged || print_redundant)
+ if (print_loose || print_purged || print_redundant)
printf("\r");
- if (print_commits)
- printf("%d commit%s scanned", ncommits,
- ncommits == 1 ? "" : "s");
if (print_loose)
- printf("; %d loose object%s", nloose, nloose == 1 ? "" : "s");
+ printf("found %d loose object%s", nloose, nloose == 1 ? "" : "s");
if (print_purged || print_redundant) {
if (a->dry_run) {
printf("; could purge %d object%s", npurged,
nredundant == 1 ? "" : "s");
}
}
- if (print_loose || print_commits || print_purged || print_redundant) {
+ if (print_loose || print_purged || print_redundant) {
a->printed_something = 1;
fflush(stdout);
}
char *repo_path = NULL;
struct got_repository *repo = NULL;
int ch, dry_run = 0, verbosity = 0;
- int ncommits = 0, nloose = 0, npacked = 0;
+ int nloose = 0, npacked = 0;
int remove_lonely_packidx = 0, ignore_mtime = 0;
struct got_pack_progress_arg ppa;
struct got_cleanup_progress_arg cpa;
ppa.verbosity = verbosity;
error = got_repo_cleanup(repo, &loose_before, &loose_after,
- &pack_before, &pack_after, &ncommits, &nloose, &npacked,
+ &pack_before, &pack_after, &nloose, &npacked,
dry_run, ignore_mtime, cleanup_progress, &cpa,
pack_progress, &ppa, pack_index_progress, &ppa,
check_cancelled, NULL);
blob - 1f1aa1805ae17f62d874299ee7221a753add3951ac9aeb75bf6e4fdbed612f5d
blob + b03123cb8b800d90041ba8980fff79220b9eac4d5e3354a260ee7d36b661566e
--- include/got_repository_admin.h
+++ include/got_repository_admin.h
/* A callback function which gets invoked with cleanup information to print. */
typedef const struct got_error *(*got_cleanup_progress_cb)(void *arg,
- int ncommits, int nloose, int npurged, int nredundant);
+ int nloose, int npurged, int nredundant);
/*
* Walk objects reachable via references and, unless the dry-run parameter
got_repo_cleanup(struct got_repository *repo,
off_t *loose_before, off_t *loose_after,
off_t *pack_before, off_t *pack_after,
- int *ncommits, int *nloose,
- int *npacked, int dry_run, int ignore_mtime,
+ int *nloose, int *npacked, int dry_run, int ignore_mtime,
got_cleanup_progress_cb progress_cb, void *progress_arg,
got_pack_progress_cb pack_progress_cb, void *pack_progress_arg,
got_pack_index_progress_cb index_progress_cb, void *index_progress_arg,
blob - 0277f75d51de4b88c4261310b5ada34f0139819d04dbdd241030c929bd08bd2e
blob + 95949c9876ad06bf5fa87714843f64d00dfeac1fbbd6975f2283dce22739715b
--- lib/repository_admin.c
+++ lib/repository_admin.c
static const struct got_error *
report_cleanup_progress(got_cleanup_progress_cb progress_cb,
void *progress_arg, struct got_ratelimit *rl,
- int ncommits, int nloose, int npurged, int nredundant)
+ int nloose, int npurged, int nredundant)
{
const struct got_error *err;
int elapsed;
if (err || !elapsed)
return err;
- return progress_cb(progress_arg, ncommits, nloose, npurged,
- nredundant);
+ return progress_cb(progress_arg, nloose, npurged, nredundant);
}
static const struct got_error *
get_loose_object_ids(struct got_object_idset **loose_ids,
- off_t *ondisk_size, int ncommits,
+ off_t *ondisk_size,
got_cleanup_progress_cb progress_cb, void *progress_arg,
struct got_ratelimit *rl, struct got_repository *repo)
{
if (err)
goto done;
err = report_cleanup_progress(progress_cb,
- progress_arg, rl, ncommits,
+ progress_arg, rl,
got_object_idset_num_elements(*loose_ids),
-1, -1);
if (err)
struct got_ratelimit *rl;
struct got_object_idset *traversed_ids;
int nloose;
- int ncommits;
int npacked;
int npurged;
off_t size_purged;
a->npurged++;
a->size_purged += sb.st_size;
err = report_cleanup_progress(a->progress_cb, a->progress_arg,
- a->rl, a->ncommits, a->nloose, a->npurged, -1);
+ a->rl, a->nloose, a->npurged, -1);
if (err)
goto done;
}
static const struct got_error *
repo_purge_unreferenced_loose_objects(struct got_repository *repo,
struct got_object_idset *traversed_ids,
- off_t *size_before, off_t *size_after, int ncommits, int *nloose,
+ off_t *size_before, off_t *size_after, int *nloose,
int *npacked, int *npurged, int dry_run, int ignore_mtime,
time_t max_mtime, struct got_ratelimit *rl,
got_cleanup_progress_cb progress_cb, void *progress_arg,
struct got_object_idset *loose_ids;
struct purge_loose_object_arg arg;
- err = get_loose_object_ids(&loose_ids, size_before, ncommits,
+ err = get_loose_object_ids(&loose_ids, size_before,
progress_cb, progress_arg, rl, repo);
if (err)
return err;
if (*nloose == 0) {
got_object_idset_free(loose_ids);
if (progress_cb) {
- err = progress_cb(progress_arg, 0, 0, 0, -1);
+ err = progress_cb(progress_arg, 0, 0, -1);
if (err)
return err;
}
/* Produce a final progress report. */
if (progress_cb) {
- err = progress_cb(progress_arg, ncommits, *nloose,
- arg.npurged, -1);
+ err = progress_cb(progress_arg, *nloose, arg.npurged, -1);
if (err)
goto done;
}
struct got_object_idset *traversed_ids,
off_t *size_before, off_t *size_after, int dry_run, int ignore_mtime,
time_t max_mtime, struct got_object_id *large_pack_hash,
- int nloose, int ncommits, int npurged,
- struct got_ratelimit *rl,
+ int nloose, int npurged, struct got_ratelimit *rl,
got_cleanup_progress_cb progress_cb, void *progress_arg,
got_cancel_cb cancel_cb, void *cancel_arg)
{
if (!is_redundant)
continue;
err = report_cleanup_progress(progress_cb, progress_arg,
- rl, ncommits, nloose, npurged, ++redundant_packs);
+ rl, nloose, npurged, ++redundant_packs);
if (err)
goto done;
}
/* Produce a final progress report. */
if (progress_cb) {
- err = progress_cb(progress_arg, ncommits, nloose, npurged,
+ err = progress_cb(progress_arg, nloose, npurged,
redundant_packs);
if (err)
goto done;
got_repo_cleanup(struct got_repository *repo,
off_t *loose_before, off_t *loose_after,
off_t *pack_before, off_t *pack_after,
- int *ncommits, int *nloose, int *npacked, int dry_run, int ignore_mtime,
+ int *nloose, int *npacked, int dry_run, int ignore_mtime,
got_cleanup_progress_cb progress_cb, void *progress_arg,
got_pack_progress_cb pack_progress_cb, void *pack_progress_arg,
got_pack_index_progress_cb index_progress_cb, void *index_progress_arg,
*loose_after = 0;
*pack_before = 0;
*pack_after = 0;
- *ncommits = 0;
*nloose = 0;
*npacked = 0;
goto done;
err = repo_purge_unreferenced_loose_objects(repo, traversed_ids,
- loose_before, loose_after, *ncommits, nloose, npacked, &npurged,
+ loose_before, loose_after, nloose, npacked, &npurged,
dry_run, ignore_mtime, max_mtime, &rl, progress_cb, progress_arg,
cancel_cb, cancel_arg);
if (err)
err = repo_purge_redundant_packfiles(repo, traversed_ids,
pack_before, pack_after, dry_run, ignore_mtime, max_mtime,
- &pack_hash, *nloose, *ncommits, npurged,
+ &pack_hash, *nloose, npurged,
&rl, progress_cb, progress_arg, cancel_cb, cancel_arg);
if (err)
goto done;