From: Siddharth Shrimali Date: Tue, 17 Mar 2026 13:28:35 GMT Subject: Re: [GSoC Proposal] Improve Disk Space Recovery for Partial Clones Message-ID: In-Reply-To: Hi Karthik, thank you for the review! Karthik Nayak wrote: Let me address each point. > > 5.1 Blob Enumeration > > > > Walk the object graph from all local refs using traverse_commit_list() > > in list-objects.c, with a size-based filter consistent with the existing > > blob:limit=N syntax from list-objects-filter.c. The goal is to collect > > blob OIDs that exceed the threshold and are currently locally present, > > meaning they resolve via find_pack_entry() or as a loose object, and are > > not already in a promised/missing state. > > How does this work when used on a partial clone with 'blob:none'? > Right, an object walk using traverse_commit_list() would hit missing trees and blobs and end up triggering a lazy-fetch storm, which is the opposite of what we want. The enumeration needs to stay strictly local. We can do this by passing OBJECT_INFO_SKIP_FETCH_OBJECT to oid_object_info_extended(), similar to how remove_fetched_oids() works. That way we only look at blobs that are physically on disk and never touch the promisor machinery. > > For remotes that do not advertise object-info, a conservative fallback > > applies: if a blob is reachable from a commit the remote has, and the > > remote's advertised filter covers that object, its presence on the > > remote is implied. > > How do we know a blob is reachable from a commit that the remote > advertises? > Fair point, I think the cleaner approach is to just drop the local fallback entirely and make Protocol v2 object-info a hard requirement for v1. It is stricter but much safer and we only drop what we can explicitly confirm the remote has. > > 5.5 Safety Guards > > > > - No in-progress operation: refuse if MERGE_HEAD, CHERRY_PICK_HEAD, > > REVERT_HEAD, or rebase-merge/ is present under .git/. Removing > > objects mid-operation could corrupt an otherwise-recoverable state. > > > > But couldn't one of these operations start after we start the process of > cleanup? > Yes, you are right. A merge or rebase could still start halfway through the cleanup and lead to a race condition. So for that, write-before-delete already handles this case. If a merge starts mid-cleanup and needs a blob we just deleted, it will not hit a fatal "object missing" error, the OID is already in the .promisor file, so the lazy-fetch mechanism is called and fetches it back transparently. The repository stays in a consistent state regardless of when the concurrent operation starts. For packfile removal, we can rely on the existing .keep and lock mechanisms natively present in the repack machinery to prevent GC collisions. > > - A new option on git backfill (e.g., --drop-blobs): backfill fills > > objects in; this flag drains them back out. The symmetry is clean > > and the command is already familiar to users working with partial > > clones. > > > > I'm not sure if 'git backfill --drop-blobs' makes sense, since the > command talks about filling in data and the flag talks about cleaning up > data. But this seems to be the closest relative. > > > - An opt-in git maintenance task for scheduled periodic space > > reclamation, wrapping the same core logic. > > > > This would be my top pick, seems like data cleanup is definitely a > maintenance task. > Agreed on both, a flag that does the opposite of what the command name says is confusing, and git maintenance is a much more natural home for something like this. I will focus the design discussion around making it a maintenance task. Thanks again for the thorough review. Siddharth Shrimali r.siddharth.shrimali@gmail.com