Re: [PATCH v2 0/2] builtin/maintenance: improve heuristic for "rerere gc"
From: Derrick Stolee <hidden>
Date: 2026-09-04 13:52:01
On 9/4/2026 3:03 AM, Patrick Steinhardt wrote:
Range-diff versus v1:
Thank you for taking the time to respond to my nitpicks. I think the end result is a bit cleaner, and the patches have some more clarity, too.
1: 343dbf1c0c ! 1: 1b0b7a7b9a rerere: extract logic to determine whether entries are stale
-@@ rerere.c: void rerere_gc(struct repository *r, struct string_list *rr)
- for (id.variant = 0, id.collection = rr_dir;
- id.variant < id.collection->status_nr;
- id.variant++) {
-- prune_one(&id, cutoff_resolve, cutoff_noresolve);
-+ if (rerere_id_is_stale(&id, cutoff_resolve, cutoff_noresolve))
-+ unlink_rr_item(&id);
- if (id.collection->status[id.variant])
- now_empty = 0;
- }I like that this diff is no longer in the patch. Thanks!
2: c8a52f0663 ! 2: 1ceb798cdf builtin/maintenance: improve heuristic for "rerere gc"
-+ if (limit <= 0)
-+ return limit < 0;
++ if (!limit)
++ return 0; /* never prune */
++ if (limit < 0)
++ return 1; /* always prune */The extra comments are helpful here, too!
-+ return rerere_gc_estimate(the_repository, limit) >= (size_t)limit;
++ return rerere_gc_needed(the_repository, (size_t)limit);This looks much cleaner, thanks! This version LGTM. -Stolee