threads / bug / 66828

[BUG] repack --drop-filtered aborts when a filtered blob is referenced by the index

Subject: [BUG] repack --drop-filtered aborts when a filtered blob is referenced by the index

## tl;dr

A user in a partial clone asks whether the command could skip index-referenced blobs and still drop the others. Read the story.

replies: 1people: 2as markdown or json

kongfankaikai· Nov 11, 2026, 16:51 UTC · lore
Hi Git developers,
I ran into an issue using `git repack --drop-filtered` in a partial clone repository.
Problem
When a blob selected by the filter for dropping is referenced by the current index, Git aborts the entire repack with:
`fatal: cannot drop 'path/to/large-file.bin' (object-id): it is referenced by the current index`
This stops other eligible blobs from being dropped, even though those blobs are not referenced by the index.
Expected behavior
I’m wondering if Git could skip blobs referenced by the index and continue dropping the rest of the eligible objects, instead of aborting the whole operation.
For example:
Blob A: eligible for dropping, not referenced by index → drop
Blob B: eligible for dropping, referenced by index → skip
Blob C: eligible for dropping, not referenced by index → drop
The repack could complete successfully, optionally emitting a warning for skipped blobs.
Question
Is there a specific reason this condition is treated as fatal rather than skipping the affected objects?
This behavior would be especially helpful for partial clones with large working trees.
Thanks!
Siddharth Shrimali· Nov 12, 2026, 07:29 UTC · re: kongfankaikai · lore

Re: [BUG] repack --drop-filtered aborts when a filtered blob is referenced by the index

Hi,
On Thu, Nov 12, 2026 at 12:51:07AM +0800, kongfankaikai wrote:
Show 8 quoted lines
> When a blob selected by the filter for dropping is referenced by the
> current index, Git aborts the entire repack with:
>
> `fatal: cannot drop 'path/to/large-file.bin' (object-id): it is
> referenced by the current index`
>
> This stops other eligible blobs from being dropped, even though those
> blobs are not referenced by the index.

Thanks for the report. This is a known limitation and a fix is already planned.

Samuel Bronson ran into exactly the same thing on a real llvm-project clone and sent an RFC patch for it in September:

  https://lore.kernel.org/git/s0vqzjavw8p.fsf@gmail.com/
and I agreed with the direction there:
  https://lore.kernel.org/git/CAGWgyh9B=re06aofii9VFB1xOwEeTtxYE=7T14m9WFAx1ORpMg@mail.gmail.com/
Show 5 quoted lines
> Is there a specific reason this condition is treated as fatal rather
> than skipping the affected objects?
>
> This behavior would be especially helpful for partial clones with
> large working trees.

No correctness reason. The guard only avoids dropping a blob that the next command would lazy-fetch right back, so such a blob is never at risk. Aborting was simply a conservative version of the guard, and as you and Samuel point out it is a poor trade-off.

The fix is to replace the die() with a warning and drop the remaining eligible blobs. I am working on this and will post it to the list.

Thanks, Siddharth

← back to recent threads