commit 808577a26fca1363896c388b85619dfdae201cc94190fa5fc1da03e48c8631e2 from: Stefan Sperling date: Sun Nov 15 15:09:44 2026 UTC remove loaded commits counter from gotadmin cleanup progress This counter was now always zero since the looping code which was raising this counter has been removed. commit - 828ad4330c114d7c18c2d02c0f18675aeff78cbfc59578675fa48fbd79161e7c commit + 808577a26fca1363896c388b85619dfdae201cc94190fa5fc1da03e48c8631e2 blob - 9428182ffecdb22fb3013026787ba3715a620b387c76da30e31692900cf8b4cf blob + 6515fa7d69cb628096b7820eece38d4dad0fe41023c093c556980ee9161b7378 --- gotadmin/gotadmin.c +++ gotadmin/gotadmin.c @@ -1171,7 +1171,6 @@ usage_cleanup(int status) struct got_cleanup_progress_arg { int last_nloose; - int last_ncommits; int last_npurged; int last_nredundant; int verbosity; @@ -1180,30 +1179,22 @@ struct got_cleanup_progress_arg { }; 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; @@ -1213,13 +1204,10 @@ cleanup_progress(void *arg, int ncommits, int nloose, 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, @@ -1238,7 +1226,7 @@ cleanup_progress(void *arg, int ncommits, int nloose, 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); } @@ -1275,7 +1263,7 @@ cmd_cleanup(int argc, char *argv[]) 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; @@ -1370,7 +1358,7 @@ cmd_cleanup(int argc, char *argv[]) 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 @@ -70,7 +70,7 @@ got_repo_list_pack(FILE *packfile, struct got_object_i /* 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 @@ -89,8 +89,7 @@ const struct got_error * 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 @@ -699,7 +699,7 @@ repo_cleanup_lock(struct got_repository *repo, struct 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; @@ -711,13 +711,12 @@ report_cleanup_progress(got_cleanup_progress_cb progre 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) { @@ -807,7 +806,7 @@ get_loose_object_ids(struct got_object_idset **loose_i 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) @@ -866,7 +865,6 @@ struct purge_loose_object_arg { struct got_ratelimit *rl; struct got_object_idset *traversed_ids; int nloose; - int ncommits; int npacked; int npurged; off_t size_purged; @@ -928,7 +926,7 @@ purge_loose_object(struct got_object_id *id, void *dat 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; } @@ -944,7 +942,7 @@ 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, @@ -954,7 +952,7 @@ repo_purge_unreferenced_loose_objects(struct got_repos 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; @@ -962,7 +960,7 @@ repo_purge_unreferenced_loose_objects(struct got_repos 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; } @@ -992,8 +990,7 @@ repo_purge_unreferenced_loose_objects(struct got_repos /* 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; } @@ -1152,8 +1149,7 @@ repo_purge_redundant_packfiles(struct got_repository * 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) { @@ -1235,14 +1231,14 @@ repo_purge_redundant_packfiles(struct got_repository * 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; @@ -1260,7 +1256,7 @@ const struct got_error * 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, @@ -1288,7 +1284,6 @@ got_repo_cleanup(struct got_repository *repo, *loose_after = 0; *pack_before = 0; *pack_after = 0; - *ncommits = 0; *nloose = 0; *npacked = 0; @@ -1357,7 +1352,7 @@ got_repo_cleanup(struct got_repository *repo, 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) @@ -1365,7 +1360,7 @@ got_repo_cleanup(struct got_repository *repo, 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;