From: Justin Tobler <jltobler@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] odb: drop gaps in object info flag values
Date: Mon, 9 Feb 2026 14:18:26 -0600 [thread overview]
Message-ID: <aYpAzVSUN9NcngFi@denethor> (raw)
In-Reply-To: <20260126-b4-pks-read-object-info-flags-v1-3-e682a003b17c@pks.im>
On 26/01/26 01:17PM, Patrick Steinhardt wrote:
> The object info flag values have a two gaps in their definitions, where
> some bits are skipped over. These gaps don't really hurt, but it makes
> one wonder whether anything is going on and whether a subset of flags
> might be defined somewhere else.
>
> That's not the case though. Instead, this is a case of flags that have
> been dropped in the past:
>
> - The value 4 was used by `OBJECT_INFO_SKIP_CACHED`, removed in
> 9c8a294a1a (sha1-file: remove OBJECT_INFO_SKIP_CACHED, 2020-01-02).
>
> - The value 8 was used by `OBJECT_INFO_ALLOW_UNKNOWN_TYPE`, removed in
> ae24b032a0 (object-file: drop OBJECT_INFO_ALLOW_UNKNOWN_TYPE flag,
> 2025-05-16).
>
> Close those gaps to avoid any more confusion. While at it, convert the
> flags to be declared as an enum and use bit shifts to follow modern best
> practices.
Makes sense.
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> odb.h | 38 ++++++++++++++++++++++----------------
> 1 file changed, 22 insertions(+), 16 deletions(-)
>
> diff --git a/odb.h b/odb.h
> index bab07755f4..1e4326b7f4 100644
> --- a/odb.h
> +++ b/odb.h
> @@ -352,23 +352,29 @@ struct object_info {
> */
> #define OBJECT_INFO_INIT { 0 }
>
> -/* Invoke lookup_replace_object() on the given hash */
> -#define OBJECT_INFO_LOOKUP_REPLACE 1
> -/* Do not retry packed storage after checking packed and loose storage */
> -#define OBJECT_INFO_QUICK 8
> -/*
> - * Do not attempt to fetch the object if missing (even if fetch_is_missing is
> - * nonzero).
> - */
> -#define OBJECT_INFO_SKIP_FETCH_OBJECT 16
> -/*
> - * This is meant for bulk prefetching of missing blobs in a partial
> - * clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK
> - */
> -#define OBJECT_INFO_FOR_PREFETCH (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK)
> +/* Flags that can be passed to `odb_read_object_info_extended()`. */
> +enum object_info_flags {
> + /* Invoke lookup_replace_object() on the given hash. */
> + OBJECT_INFO_LOOKUP_REPLACE = (1 << 0),
> +
> + /* Do not reprepare object sources when the first lookup has failed. */
> + OBJECT_INFO_QUICK = (1 << 1),
> +
> + /*
> + * Do not attempt to fetch the object if missing (even if fetch_is_missing is
> + * nonzero).
> + */
> + OBJECT_INFO_SKIP_FETCH_OBJECT = (1 << 2),
> +
> + /* Die if object corruption (not just an object being missing) was detected. */
> + OBJECT_INFO_DIE_IF_CORRUPT = (1 << 3),
>
> -/* Die if object corruption (not just an object being missing) was detected. */
> -#define OBJECT_INFO_DIE_IF_CORRUPT 32
> + /*
> + * This is meant for bulk prefetching of missing blobs in a partial
> + * clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK.
> + */
> + OBJECT_INFO_FOR_PREFETCH = (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK),
The changes here all look obviously correct to me. Looks good.
-Justin
next prev parent reply other threads:[~2026-02-09 20:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 12:17 [PATCH 0/3] Small fixups for `OBJECT_INFO` flags Patrick Steinhardt
2026-01-26 12:17 ` [PATCH 1/3] builtin/backfill: fix flags passed to `odb_has_object()` Patrick Steinhardt
2026-01-26 20:17 ` Derrick Stolee
2026-01-26 21:07 ` Junio C Hamano
2026-02-09 19:57 ` Justin Tobler
2026-02-10 9:24 ` Karthik Nayak
2026-02-10 9:32 ` Karthik Nayak
2026-01-26 12:17 ` [PATCH 2/3] builtin/fsck: " Patrick Steinhardt
2026-02-09 20:04 ` Justin Tobler
2026-01-26 12:17 ` [PATCH 3/3] odb: drop gaps in object info flag values Patrick Steinhardt
2026-01-26 16:58 ` Junio C Hamano
2026-01-26 18:02 ` René Scharfe
2026-01-26 18:13 ` Junio C Hamano
2026-01-27 6:29 ` Patrick Steinhardt
2026-02-09 20:32 ` Justin Tobler
2026-02-09 20:18 ` Justin Tobler [this message]
2026-01-26 16:28 ` [PATCH 0/3] Small fixups for `OBJECT_INFO` flags Junio C Hamano
2026-02-12 6:59 ` [PATCH v2 0/5] " Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 1/5] builtin/backfill: fix flags passed to `odb_has_object()` Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 2/5] builtin/fsck: " Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 3/5] odb: drop gaps in object info flag values Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 4/5] odb: convert object info flags into an enum Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 5/5] odb: convert `odb_has_object()` " 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=aYpAzVSUN9NcngFi@denethor \
--to=jltobler@gmail.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.