git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] repack --drop-filtered --dry-run writes packs and honors -d in Git 2.56.0

From
Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Date
Oct 8, 2026, 02:25 UTC
Message-ID
<CAGWgyh9QTN8T=ZyvbEGA16acNw4KGLBeg1R4mt=E_nAGGU8APA@mail.gmail.com>
In-Reply-To
<CALnO6CCmv7PmxW2HTfvD8i6-PCVqMWgasyU9PYhPLXGj1sz=Hg@mail.gmail.com>
Hi Coy,
On Thu, 8 Oct 2026 at 00:40, D. Ben Knoble <ben.knoble@gmail.com> wrote:
>
> Cc: Siddharth Shrimali <r.siddharth.shrimali@gmail.com> who authored
> the --drop-filtered code.
Thanks Ben for the cc
Show 6 quoted lines
> On Sun, Oct 4, 2026 at 7:47 PM Coy Geek <coygeek@gmail.com> 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

Previous: D. Ben Knoble
Message 3 of 3 in “[BUG] repack --drop-filtered --dry-run writes packs and honors -d in Git 2.56.0”
  1. Coy GeekOct 4, 2026
  2. D. Ben KnobleOct 7, 2026
  3. Siddharth ShrimaliOct 8, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.