# repack --drop-filtered --dry-run rebuilds and deletes packs despite its documentation

_The dry-run option falls through into the normal repack code, so a command documented as non-destructive can modify the repository._

Section: Bugs. Edition of 2026-10-18. Written by an AI editor from the thread "[PATCH] repack: do not rebuild packs on --dry-run" (14 messages): https://gitlist.dev/t/66486

Siddharth Shrimali's patch addresses a bug in cmd_repack(). The documentation says `git repack --drop-filtered --dry-run` lists the objects that would be dropped "without rebuilding any pack or deleting anything". In practice, after printing the candidates the --dry-run block falls through into the regular repack code.

As a result, repack_promisor_objects() writes a new promisor pack. With -d, existing_packs_remove_redundant() also deletes the old packs. The command still exits successfully, so the user is not told the repository was changed.

The existing guard only skips the implied "delete_redundant = 1". It does not stop an explicit -d or the writing of the new pack. The patch fixes this by returning right after the candidates are printed.

The thread has 13 messages, with Junio C Hamano, Patrick Steinhardt and Ben Knoble taking part. In the latest message Shrimali answered Hamano that the advice made sense and that he will keep it in mind for future patches. The excerpts do not show whether the patch has been accepted.
