From: Toon Claes <toon@iotcl.com>
To: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Cc: Justin Tobler <jltobler@gmail.com>,
Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
Taylor Blau <ttaylorr@openai.com>
Subject: Re: [PATCH v3 7/9] pack-bitmap: introduce function to open bitmap for a single source
Date: Wed, 15 Jul 2026 07:25:54 +0200 [thread overview]
Message-ID: <875x2gn7rx.fsf@emacs.iotcl.com> (raw)
In-Reply-To: <20260713-pks-odb-for-each-object-filter-v3-7-b3c65c641073@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
> The function `prepare_bitmap_git()` opens the first bitmap it can find
> in any of the object sources connected to the repository. In a
> subsequent commit, the "packed" object database backend will learn to
> use bitmaps to answer object filters when enumerating objects. That
> backend operates on a single object source though, so using a bitmap
> that potentially belongs to a different source would be wrong:
>
> - The source would yield objects that are not part of the source
> itself.
>
> - The object source info would be attributed to the wrong source.
>
> - With multiple sources, each source would enumerate the same bitmap
> another time.
>
> Introduce a new function `prepare_source_bitmap_git()` that only opens
> bitmaps belonging to the given object source.
Tinies nit: this should be `prepare_bitmap_git_for_source()`
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> pack-bitmap.c | 12 ++++++++++++
> pack-bitmap.h | 2 ++
> 2 files changed, 14 insertions(+)
>
> diff --git a/pack-bitmap.c b/pack-bitmap.c
> index 72c8ae3228..09ba15d26b 100644
> --- a/pack-bitmap.c
> +++ b/pack-bitmap.c
> @@ -753,6 +753,18 @@ struct bitmap_index *prepare_midx_bitmap_git(struct multi_pack_index *midx)
> return NULL;
> }
>
> +struct bitmap_index *prepare_bitmap_git_for_source(struct odb_source_packed *source)
> +{
> + struct bitmap_index *bitmap_git = xcalloc(1, sizeof(*bitmap_git));
> +
> + if (!open_bitmap_for_source(source, bitmap_git) &&
> + !load_bitmap(source->base.odb->repo, bitmap_git, 0))
> + return bitmap_git;
> +
> + free_bitmap_index(bitmap_git);
> + return NULL;
> +}
> +
> int bitmap_index_contains_pack(struct bitmap_index *bitmap, struct packed_git *pack)
> {
> for (; bitmap; bitmap = bitmap->base) {
> diff --git a/pack-bitmap.h b/pack-bitmap.h
> index ae8dc491ac..9f20fb6e56 100644
> --- a/pack-bitmap.h
> +++ b/pack-bitmap.h
> @@ -9,6 +9,7 @@
> #include "string-list.h"
>
> struct commit;
> +struct odb_source_packed;
> struct repository;
> struct rev_info;
>
> @@ -68,6 +69,7 @@ struct bitmapped_pack {
>
> struct bitmap_index *prepare_bitmap_git(struct repository *r);
> struct bitmap_index *prepare_midx_bitmap_git(struct multi_pack_index *midx);
> +struct bitmap_index *prepare_bitmap_git_for_source(struct odb_source_packed *source);
>
> /*
> * Given a bitmap index, determine whether it contains the pack either directly
>
> --
> 2.55.0.313.g8d093f411d.dirty
>
>
--
Cheers,
Toon
next prev parent reply other threads:[~2026-07-15 5:26 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 8:35 [PATCH 0/7] odb: introduce object filters to `odb_for_each_object()` Patrick Steinhardt
2026-07-09 8:35 ` [PATCH 1/7] odb/source-packed: improve lookup when enumerating objects Patrick Steinhardt
2026-07-09 19:54 ` Justin Tobler
2026-07-10 7:08 ` Patrick Steinhardt
2026-07-09 8:35 ` [PATCH 2/7] pack-bitmap: mark object filter as `const` Patrick Steinhardt
2026-07-09 8:35 ` [PATCH 3/7] pack-bitmap: allow aborting iteration of bitmapped objects Patrick Steinhardt
2026-07-09 20:19 ` Justin Tobler
2026-07-10 7:08 ` Patrick Steinhardt
2026-07-11 7:47 ` Jeff King
2026-07-09 8:35 ` [PATCH 4/7] pack-bitmap: iterate object sources when opening bitmaps Patrick Steinhardt
2026-07-09 21:08 ` Justin Tobler
2026-07-10 7:08 ` Patrick Steinhardt
2026-07-09 8:35 ` [PATCH 5/7] pack-bitmap: introduce function to open bitmap for a single source Patrick Steinhardt
2026-07-09 8:35 ` [PATCH 6/7] odb: introduce object filters to `odb_for_each_object()` Patrick Steinhardt
2026-07-09 21:43 ` Justin Tobler
2026-07-10 7:09 ` Patrick Steinhardt
2026-07-15 5:09 ` Toon Claes
2026-07-09 8:35 ` [PATCH 7/7] builtin/cat-file: filter objects via object database Patrick Steinhardt
2026-07-09 18:59 ` Junio C Hamano
2026-07-10 7:09 ` Patrick Steinhardt
2026-07-10 8:48 ` [PATCH v2 0/8] odb: introduce object filters to `odb_for_each_object()` Patrick Steinhardt
2026-07-10 8:48 ` [PATCH v2 1/8] odb/source-packed: improve lookup when enumerating objects Patrick Steinhardt
2026-07-10 22:25 ` Taylor Blau
2026-07-13 9:54 ` Patrick Steinhardt
2026-07-14 3:49 ` Taylor Blau
2026-07-14 5:35 ` Patrick Steinhardt
2026-07-10 8:48 ` [PATCH v2 2/8] pack-bitmap: mark object filter as `const` Patrick Steinhardt
2026-07-10 22:25 ` Taylor Blau
2026-07-10 8:48 ` [PATCH v2 3/8] pack-bitmap: allow aborting iteration of bitmapped objects Patrick Steinhardt
2026-07-10 22:34 ` Taylor Blau
2026-07-11 8:01 ` Jeff King
2026-07-13 9:53 ` Patrick Steinhardt
2026-07-14 3:58 ` Taylor Blau
2026-07-14 7:17 ` Jeff King
2026-07-10 8:48 ` [PATCH v2 4/8] pack-bitmap: iterate object sources when opening bitmaps Patrick Steinhardt
2026-07-10 22:40 ` Taylor Blau
2026-07-10 8:48 ` [PATCH v2 5/8] pack-bitmap: drop `_1` suffix from functions that open bitmaps Patrick Steinhardt
2026-07-10 22:41 ` Taylor Blau
2026-07-10 8:48 ` [PATCH v2 6/8] pack-bitmap: introduce function to open bitmap for a single source Patrick Steinhardt
2026-07-10 8:48 ` [PATCH v2 7/8] odb: introduce object filters to `odb_for_each_object()` Patrick Steinhardt
2026-07-10 22:42 ` Taylor Blau
2026-07-10 8:49 ` [PATCH v2 8/8] builtin/cat-file: filter objects via object database Patrick Steinhardt
2026-07-11 7:58 ` [PATCH v2 9/8?] pack-objects: drop unused return value from add_object_entry() Jeff King
2026-07-11 16:42 ` Junio C Hamano
2026-07-13 14:41 ` [PATCH v3 0/9] odb: introduce object filters to `odb_for_each_object()` Patrick Steinhardt
2026-07-13 14:41 ` [PATCH v3 1/9] odb/source-packed: improve lookup when enumerating objects Patrick Steinhardt
2026-07-13 14:41 ` [PATCH v3 2/9] pack-bitmap: mark object filter as `const` Patrick Steinhardt
2026-07-13 14:41 ` [PATCH v3 3/9] pack-objects: drop unused return value from add_object_entry() Patrick Steinhardt
2026-07-13 14:41 ` [PATCH v3 4/9] pack-bitmap: allow aborting iteration of bitmapped objects Patrick Steinhardt
2026-07-13 14:41 ` [PATCH v3 5/9] pack-bitmap: iterate object sources when opening bitmaps Patrick Steinhardt
2026-07-13 14:41 ` [PATCH v3 6/9] pack-bitmap: drop `_1` suffix from functions that open bitmaps Patrick Steinhardt
2026-07-13 14:41 ` [PATCH v3 7/9] pack-bitmap: introduce function to open bitmap for a single source Patrick Steinhardt
2026-07-15 5:25 ` Toon Claes [this message]
2026-07-15 6:22 ` Patrick Steinhardt
2026-07-13 14:41 ` [PATCH v3 8/9] odb: introduce object filters to `odb_for_each_object()` Patrick Steinhardt
2026-07-15 5:27 ` Toon Claes
2026-07-13 14:41 ` [PATCH v3 9/9] builtin/cat-file: filter objects via object database Patrick Steinhardt
2026-07-15 5:41 ` Toon Claes
2026-07-14 3:59 ` [PATCH v3 0/9] odb: introduce object filters to `odb_for_each_object()` Taylor Blau
2026-07-14 5:36 ` Patrick Steinhardt
2026-07-15 5:43 ` Toon Claes
2026-07-15 6:21 ` Patrick Steinhardt
2026-07-14 7:17 ` Jeff King
2026-07-15 6:22 ` [PATCH v4 " Patrick Steinhardt
2026-07-15 6:22 ` [PATCH v4 1/9] odb/source-packed: improve lookup when enumerating objects Patrick Steinhardt
2026-07-15 6:22 ` [PATCH v4 2/9] pack-bitmap: mark object filter as `const` Patrick Steinhardt
2026-07-15 6:22 ` [PATCH v4 3/9] pack-objects: drop unused return value from add_object_entry() Patrick Steinhardt
2026-07-15 6:22 ` [PATCH v4 4/9] pack-bitmap: allow aborting iteration of bitmapped objects Patrick Steinhardt
2026-07-15 6:22 ` [PATCH v4 5/9] pack-bitmap: iterate object sources when opening bitmaps Patrick Steinhardt
2026-07-15 6:22 ` [PATCH v4 6/9] pack-bitmap: drop `_1` suffix from functions that open bitmaps Patrick Steinhardt
2026-07-15 6:22 ` [PATCH v4 7/9] pack-bitmap: introduce function to open bitmap for a single source Patrick Steinhardt
2026-07-15 6:22 ` [PATCH v4 8/9] odb: introduce object filters to `odb_for_each_object()` Patrick Steinhardt
2026-07-15 6:22 ` [PATCH v4 9/9] builtin/cat-file: filter objects via object database Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875x2gn7rx.fsf@emacs.iotcl.com \
--to=toon@iotcl.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jltobler@gmail.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
--cc=ttaylorr@openai.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox