public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] xdiff-interface: stop using the_repository
Date: Mon, 09 Feb 2026 03:15:51 -0800	[thread overview]
Message-ID: <xmqqms1i6uc8.fsf@gitster.g> (raw)
In-Reply-To: <f58fa33d-b015-4339-819a-9d91be60cd0c@web.de> ("René Scharfe"'s message of "Sun, 8 Feb 2026 14:47:40 +0100")

René Scharfe <l.s.r@web.de> writes:

> Use the algorithm-agnostic is_null_oid() and push the dependency of
> read_mmblob() on the_repository->objects to its callers.  This allows it
> to be used with arbitrary object databases.

> diff --git a/xdiff-interface.c b/xdiff-interface.c
> index 1a35556380..cd7493730b 100644
> --- a/xdiff-interface.c
> +++ b/xdiff-interface.c
> ...
> -void read_mmblob(mmfile_t *ptr, const struct object_id *oid)
> +void read_mmblob(mmfile_t *ptr, struct object_database *odb,
> +		 const struct object_id *oid)

A possible alternative may be to pass "struct repository *" here,
but this passes the (current) smallest piece of data necessary to
drive the helper function odb_read_object(), so it would be fine.

>  {
>  	unsigned long size;
>  	enum object_type type;
>  
> -	if (oideq(oid, null_oid(the_hash_algo))) {
> +	if (is_null_oid(oid)) {
>  		ptr->ptr = xstrdup("");
>  		ptr->size = 0;
>  		return;
>  	}
>  
> -	ptr->ptr = odb_read_object(the_repository->objects, oid, &type, &size);
> +	ptr->ptr = odb_read_object(odb, oid, &type, &size);
>  	if (!ptr->ptr || type != OBJ_BLOB)
>  		die("unable to read blob object %s", oid_to_hex(oid));
>  	ptr->size = size;


  parent reply	other threads:[~2026-02-09 11:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-08 13:47 [PATCH] xdiff-interface: stop using the_repository René Scharfe
2026-02-09  9:48 ` Patrick Steinhardt
2026-02-09 14:14   ` René Scharfe
2026-02-09 11:15 ` Junio C Hamano [this message]
2026-02-09 15:21   ` René Scharfe
2026-02-09 17:45     ` Junio C Hamano
2026-02-09 19:24       ` René Scharfe
2026-02-09 18:57 ` Elijah Newren
2026-02-09 20:01   ` Junio C Hamano
2026-02-15 18:42     ` René Scharfe
2026-02-15 18:42   ` René Scharfe
2026-02-09 19:24 ` [PATCH v2] " René Scharfe
2026-02-10 13:28   ` Patrick Steinhardt
2026-02-10 21:31     ` Junio C Hamano

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=xmqqms1i6uc8.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    /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