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

Re: [GSoC PATCH v4 4/7] builtin/repack: enumerate promisor blobs for --drop-filtered

From
Christian Couder <christian.couder@gmail.com>
Date
Aug 12, 2026, 17:21 UTC
Message-ID
<CAP8UFD3fF+Ka0Sqs3BSstur_HdqU3s==3ash91Ewwi_F-t2oDA@mail.gmail.com>
In-Reply-To
<20260810174047.6524-5-r.siddharth.shrimali@gmail.com>

On Mon, Aug 10, 2026 at 7:41 PM Siddharth Shrimali <r.siddharth.shrimali@gmail.com> wrote:

Show 21 quoted lines
> +int enumerate_promisor_blobs(struct repository *repo,
> +                            const struct list_objects_filter_options *filter,
> +                            struct oidset *to_drop)
> +{
> +       struct oidset all_promisor_blobs = OIDSET_INIT;
> +       struct collect_cb_data cb = {
> +               .repo = repo,
> +               .set = &all_promisor_blobs
> +       };
> +       int ret = 0;
> +
> +       /*
> +        * The caller (cmd_repack) is responsible for validating that a
> +        * blob:limit filter and a promisor remote are present before
> +        * calling this function.
> +        *
> +        * Walk only promisor objects. every object visited here is a
> +        * promisor object, so it is recoverable from the promisor remote
> +        * as long as the remote still has it, the same assumption the rest
> +        * of partial clone relies on
> +

The sentence that ends with "of partial clone relies on" should be finished with a full stop. And the next line should have a "*" as it is part of a code comment.

Show 24 quoted lines
> +        * We do not use write_filtered_pack() here because git repack
> +        * routes promisor objects through repack_promisor_objects()
> +        * before the filter machinery runs, so the filtered pack never
> +        * contains promisor blobs. Direct enumeration via
> +        * ODB_FOR_EACH_OBJECT_PROMISOR_ONLY is the correct approach.
> +        */
> +       ret = odb_for_each_object(repo->objects, NULL,
> +                       collect_promisor_blob, &cb,
> +                       ODB_FOR_EACH_OBJECT_PROMISOR_ONLY);
> +       if (ret)
> +               goto cleanup;
> +
> +       /*
> +        * Apply the filter to find which blobs exceed the threshold.
> +        */
> +       ret = list_objects_filter__filter_oidset(repo,
> +               (struct list_objects_filter_options *)filter,
> +               &all_promisor_blobs,
> +               to_drop);
> +
> +cleanup:
> +       oidset_clear(&all_promisor_blobs);
> +       return ret;
> +}
[...]
Show 22 quoted lines
> diff --git a/t/t7706-repack-drop-filtered.sh b/t/t7706-repack-drop-filtered.sh
> index f27b09a30e..453053cc18 100755
> --- a/t/t7706-repack-drop-filtered.sh
> +++ b/t/t7706-repack-drop-filtered.sh
> @@ -1,9 +1,36 @@
>  #!/bin/sh
>
> -test_description='git repack --drop-filtered option validation'
> +test_description='git repack --drop-filtered enumerates filtered promisor blobs'
>
>  . ./test-lib.sh
>
> +delete_object () {
> +       local repo="$1" &&
> +       local obj="$2" &&
> +       local path="$repo/.git/objects/$(test_oid_to_path "$obj")" &&
> +       rm "$path"
> +}
> +
> +# pack the objects into a promisor pack inside "repo". it is a pack
> +# accompanied by an empty ".promisor" marker file. objects
> +# in such a pack are treated as recoverable from the promisor remote.

Here and in other places in this and other patches, code comments would read better if they were proper sentences starting with an uppercase letter (and ending with a full stop). Like:

# Pack the objects into a promisor pack inside "repo". It is a pack # accompanied by an empty ".promisor" marker file. Objects # in such a pack are treated as recoverable from the promisor remote.

Show 5 quoted lines
> +pack_as_from_promisor () {
> +       HASH=$(git -C repo pack-objects .git/objects/pack/pack) &&
> +       >repo/.git/objects/pack/pack-$HASH.promisor &&
> +       echo $HASH
> +}
Previous: Siddharth ShrimaliNext: Siddharth Shrimali
Message 56 of 76 in “repack: add --drop-filtered to reclaim space in partial clones”
  1. 0/7 repack: add --drop-filtered to reclaim space in partial clonesSiddharth Shrimali, Jul 16, 2026
  2. 1/7 builtin/repack.c: add --drop-filtered and --dry-run optionsSiddharth Shrimali, Jul 16, 2026
  3. Junio C HamanoJul 16, 2026
  4. Siddharth ShrimaliJul 17, 2026
  5. Siddharth AsthanaJul 23, 2026
  6. Christian CouderJul 18, 2026
  7. Siddharth ShrimaliJul 20, 2026
  8. 2/7 list-objects-filter: add list_objects_filter__filter_oidset()Siddharth Shrimali, Jul 16, 2026
  9. 3/7 repack-promisor: allow excluding objects from the rebuilt promisor packSiddharth Shrimali, Jul 16, 2026
  10. 4/7 builtin/repack: enumerate promisor blobs for --drop-filteredSiddharth Shrimali, Jul 16, 2026
  11. 5/7 t7706: test --drop-filtered enumeration and validationSiddharth Shrimali, Jul 16, 2026
  12. 6/7 builtin/repack: actually drop filtered promisor blobsSiddharth Shrimali, Jul 16, 2026
  13. Siddharth AsthanaJul 23, 2026
  14. Siddharth ShrimaliJul 25, 2026
  15. 7/7 repack-promisor: record dropped objects in a drop logSiddharth Shrimali, Jul 16, 2026
  16. Siddharth AsthanaJul 23, 2026
  17. Siddharth ShrimaliJul 25, 2026
  18. Siddharth AsthanaJul 23, 2026
  19. Siddharth ShrimaliJul 25, 2026
  20. 0/7 repack: add --drop-filtered to reclaim space in partial clonesSiddharth Shrimali, Jul 30, 2026
  21. 1/7 builtin/repack.c: add --drop-filtered and --dry-run optionsSiddharth Shrimali, Jul 30, 2026
  22. Siddharth AsthanaAug 4, 2026
  23. 2/7 list-objects-filter: add list_objects_filter__filter_oidset()Siddharth Shrimali, Jul 30, 2026
  24. 3/7 repack-promisor: allow excluding objects from the rebuilt promisor packSiddharth Shrimali, Jul 30, 2026
  25. 4/7 builtin/repack: enumerate promisor blobs for --drop-filteredSiddharth Shrimali, Jul 30, 2026
  26. 5/7 builtin/repack: actually drop filtered promisor blobsSiddharth Shrimali, Jul 30, 2026
  27. 6/7 builtin/repack: add safety guards for --drop-filteredSiddharth Shrimali, Jul 30, 2026
  28. Siddharth AsthanaAug 4, 2026
  29. 7/7 Documentation/git-repack: document --drop-filtered and --dry-runSiddharth Shrimali, Jul 30, 2026
  30. Junio C HamanoJul 31, 2026
  31. Siddharth ShrimaliAug 1, 2026
  32. Junio C HamanoAug 2, 2026
  33. Siddharth ShrimaliAug 2, 2026
  34. Siddharth AsthanaAug 4, 2026
  35. 0/7 repack: add --drop-filtered to reclaim space in partial clonesSiddharth Shrimali, Aug 6, 2026
  36. 1/7 builtin/repack.c: add --drop-filtered and --dry-run optionsSiddharth Shrimali, Aug 6, 2026
  37. 2/7 list-objects-filter: add list_objects_filter__filter_oidset()Siddharth Shrimali, Aug 6, 2026
  38. 3/7 repack-promisor: allow excluding objects from the rebuilt promisor packSiddharth Shrimali, Aug 6, 2026
  39. 4/7 builtin/repack: enumerate promisor blobs for --drop-filteredSiddharth Shrimali, Aug 6, 2026
  40. 5/7 builtin/repack: actually drop filtered promisor blobsSiddharth Shrimali, Aug 6, 2026
  41. 6/7 builtin/repack: add guards for --drop-filteredSiddharth Shrimali, Aug 6, 2026
  42. 7/7 Documentation/git-repack: document --drop-filtered and --dry-runSiddharth Shrimali, Aug 6, 2026
  43. Junio C HamanoAug 6, 2026
  44. Junio C HamanoAug 6, 2026
  45. Siddharth ShrimaliAug 7, 2026
  46. Junio C HamanoAug 7, 2026
  47. Siddharth ShrimaliAug 8, 2026
  48. 0/7 repack: add --drop-filtered to reclaim space in partial clonesSiddharth Shrimali, Aug 10, 2026
  49. 1/7 builtin/repack.c: add --drop-filtered and --dry-run optionsSiddharth Shrimali, Aug 10, 2026
  50. 2/7 list-objects-filter: add list_objects_filter__filter_oidset()Siddharth Shrimali, Aug 10, 2026
  51. Christian CouderAug 12, 2026
  52. Junio C HamanoAug 12, 2026
  53. Siddharth ShrimaliAug 12, 2026
  54. 3/7 repack-promisor: allow excluding objects from the rebuilt promisor packSiddharth Shrimali, Aug 10, 2026
  55. 4/7 builtin/repack: enumerate promisor blobs for --drop-filteredSiddharth Shrimali, Aug 10, 2026
  56. Christian CouderAug 12, 2026
  57. 5/7 builtin/repack: actually drop filtered promisor blobsSiddharth Shrimali, Aug 10, 2026
  58. 6/7 builtin/repack: add guards for --drop-filteredSiddharth Shrimali, Aug 10, 2026
  59. Christian CouderAug 12, 2026
  60. Siddharth ShrimaliAug 12, 2026
  61. 7/7 Documentation/git-repack: document --drop-filtered and --dry-runSiddharth Shrimali, Aug 10, 2026
  62. Christian CouderAug 12, 2026
  63. Junio C HamanoAug 11, 2026
  64. Siddharth ShrimaliAug 12, 2026
  65. 0/6 repack: add --drop-filtered to reclaim space in partial clonesSiddharth Shrimali, Aug 13, 2026
  66. 1/6 builtin/repack: add --drop-filtered and --dry-run optionsSiddharth Shrimali, Aug 13, 2026
  67. 2/6 list-objects-filter: add list_objects_filter__filter_oidset()Siddharth Shrimali, Aug 13, 2026
  68. 3/6 repack-promisor: allow excluding objects from the rebuilt promisor packSiddharth Shrimali, Aug 13, 2026
  69. 4/6 builtin/repack: enumerate promisor blobs for --drop-filteredSiddharth Shrimali, Aug 13, 2026
  70. 5/6 builtin/repack: actually drop filtered promisor blobsSiddharth Shrimali, Aug 13, 2026
  71. 6/6 builtin/repack: add guards for --drop-filteredSiddharth Shrimali, Aug 13, 2026
  72. Samuel BronsonSep 3, 2026
  73. Siddharth ShrimaliSep 4, 2026
  74. Christian CouderAug 14, 2026
  75. Junio C HamanoAug 14, 2026
  76. Siddharth ShrimaliAug 14, 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.