git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org,  Aaron Plattner <aplattner@nvidia.com>
Subject: Re: [PATCH 2/8] packfile: always declare object info to be OI_PACKED
Date: Thu, 18 Dec 2025 16:23:03 +0900	[thread overview]
Message-ID: <xmqqh5toxnhk.fsf@gitster.g> (raw)
In-Reply-To: <20251218-b4-pks-odb-read-object-info-improvements-v1-2-81c8368492be@pks.im> (Patrick Steinhardt's message of "Thu, 18 Dec 2025 07:28:12 +0100")

Patrick Steinhardt <ps@pks.im> writes:

> When reading object info via a packfile we yield one of two types:
>
>   - The object can either be OI_PACKED, which is what a caller would
>     typically expect.
>
>   - Or it can be OI_DBCACHED if it is stored in the delta base cache.
>
> The latter really is an implementation detail though, and callers
> typically don't care at all about the difference. Furthermore, the
> information whether or not it is part of the delta base cache can
> already be derived via the `is_delta` field, so the fact that we discern
> between OI_PACKED and OI_DBCACHED only further complicates the
> interface.

If this were "and no existing callers check at all", it would be
trivial to decide for this change.  In fact you do say that but in a
weaker form just below.

> Drop the OI_DBCACHED enum completely. There don't seem to be any callers
> that care about the distinction.

"git grep OI_DBCACHED" shows only a single hit, which is what you
are getting rid of in this patch, but I cannot claim that we did a
sufficient audit, as this change will break code paths that check if
they got OI_PACKED and do something differently (or if what they got
is different from OI_PACKED, for that matter).

>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  odb.h      | 1 -
>  packfile.c | 3 +--
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/odb.h b/odb.h
> index 014cd9585a..73b0b87ad5 100644
> --- a/odb.h
> +++ b/odb.h
> @@ -330,7 +330,6 @@ struct object_info {
>  		OI_CACHED,
>  		OI_LOOSE,
>  		OI_PACKED,
> -		OI_DBCACHED
>  	} whence;
>  	union {
>  		/*
> diff --git a/packfile.c b/packfile.c
> index c88bd92619..79ad9d7179 100644
> --- a/packfile.c
> +++ b/packfile.c
> @@ -1656,8 +1656,7 @@ int packed_object_info(struct repository *r, struct packed_git *p,
>  			oidclr(oi->delta_base_oid, p->repo->hash_algo);
>  	}
>  
> -	oi->whence = in_delta_base_cache(p, obj_offset) ? OI_DBCACHED :
> -							  OI_PACKED;
> +	oi->whence = OI_PACKED;
>  
>  out:
>  	unuse_pack(&w_curs);

  reply	other threads:[~2025-12-18  7:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18  6:28 [PATCH 0/8] Improvements for reading object info Patrick Steinhardt
2025-12-18  6:28 ` [PATCH 1/8] object-file: always set OI_LOOSE when " Patrick Steinhardt
2025-12-18  6:28 ` [PATCH 2/8] packfile: always declare object info to be OI_PACKED Patrick Steinhardt
2025-12-18  7:23   ` Junio C Hamano [this message]
2025-12-18  9:10     ` Patrick Steinhardt
2025-12-18  6:28 ` [PATCH 3/8] packfile: extend `is_delta` field to allow for "unknown" state Patrick Steinhardt
2025-12-18  6:28 ` [PATCH 4/8] packfile: always populate pack-specific info when reading object info Patrick Steinhardt
2025-12-18  7:32   ` Junio C Hamano
2025-12-18  6:28 ` [PATCH 5/8] packfile: disentangle return value of `packed_object_info()` Patrick Steinhardt
2025-12-18  6:28 ` [PATCH 6/8] packfile: skip unpacking object header for disk size requests Patrick Steinhardt
2025-12-18  6:28 ` [PATCH 7/8] packfile: fix short-circuiting of empty requests Patrick Steinhardt
2025-12-18  6:28 ` [PATCH 8/8] packfile: drop repository parameter from `packed_object_info()` Patrick Steinhardt
2025-12-18  8:09 ` [PATCH 0/8] Improvements for reading object info Junio C Hamano
2025-12-18  8:30   ` Patrick Steinhardt
2025-12-18 10:54 ` [PATCH v2 0/7] " Patrick Steinhardt
2025-12-18 10:54   ` [PATCH v2 1/7] object-file: always set OI_LOOSE when " Patrick Steinhardt
2025-12-18 10:54   ` [PATCH v2 2/7] packfile: always declare object info to be OI_PACKED Patrick Steinhardt
2025-12-18 10:54   ` [PATCH v2 3/7] packfile: extend `is_delta` field to allow for "unknown" state Patrick Steinhardt
2025-12-18 10:54   ` [PATCH v2 4/7] packfile: always populate pack-specific info when reading object info Patrick Steinhardt
2025-12-30 17:03     ` Kristoffer Haugsbakk
2025-12-18 10:54   ` [PATCH v2 5/7] packfile: disentangle return value of `packed_object_info()` Patrick Steinhardt
2025-12-18 10:54   ` [PATCH v2 6/7] packfile: skip unpacking object header for disk size requests Patrick Steinhardt
2025-12-18 10:54   ` [PATCH v2 7/7] packfile: drop repository parameter from `packed_object_info()` 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=xmqqh5toxnhk.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=aplattner@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).