From: Siddharth Shrimali Date: Thu, 08 Oct 2026 02:25:34 GMT Subject: Re: [BUG] repack --drop-filtered --dry-run writes packs and honors -d in Git 2.56.0 Message-ID: In-Reply-To: Hi Coy, On Thu, 8 Oct 2026 at 00:40, D. Ben Knoble wrote: > > Cc: Siddharth Shrimali who authored > the --drop-filtered code. Thanks Ben for the cc > On Sun, Oct 4, 2026 at 7:47 PM Coy Geek wrote: > > > > On Git 2.56.0, `git repack -a --filter=blob:limit=1m --drop-filtered > > --dry-run` prints the candidate blob but also writes a new promisor > > pack and its sidecar files. Adding explicit `-d` also removes the old > > redundant packs and their sidecar files. Thanks for the report and the reproducer. The issue is that the --dry-run block in cmd_repack() prints the candidates but does not stop there. it falls through to repack_promisor_objects(), which writes the new promisor pack, and with an explicit -d it also reaches existing_packs_remove_redundant(), which deletes the old packs. the earlier "if (!dry_run) delete_redundant = 1" only stops -d from being implied, not from being given explicitly. The fix is two lines in builtin/repack.c: at the end of the "if (dry_run)" block, right after the loop that prints the candidate object IDs, add ret = 0; goto cleanup; so a dry run returns as soon as the candidates are listed, before any pack is rebuilt or deleted. I will also add a test to t/t7706-repack-drop-filtered.sh that runs the dry run both without and with -d, and checks that the pack directory is unchanged, the candidate is still printed, and the blob is still present I will send the patch shortly Thanks, Siddharth