From: Tian Yuchen <cat@malon.dev>
To: Luca Stefani <luca.stefani.ge1@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] git diff --no-index segfaults on large files (NULL object database)
Date: Sun, 5 Apr 2026 01:07:27 +0800 [thread overview]
Message-ID: <4be492cf-347b-4fa5-9bdd-83e7ea8abd92@malon.dev> (raw)
In-Reply-To: <CAO0HQ0VEJsG6MYrp_bSTuU09PDsypGPrM0XazvM8er0kB32Gqg@mail.gmail.com>
On 4/5/26 00:53, Luca Stefani wrote:
> Thanks for looking into it.
> Locally, I simply check against null storage and it works just fine,
> flags is always 0 in my experiments so a check against
> INDEX_WRITE_OBJECT also worked.
>
> diff --git a/object-file.c b/object-file.c
> index f0b029ff0b..68303aa99c 100644
> --- a/object-file.c
> +++ b/object-file.c
> @@ -1654,7 +1654,8 @@ int index_fd(struct index_state *istate, struct
> object_id *oid,
> } else if ((st->st_size >= 0 &&
> (size_t)st->st_size <=
> repo_settings_get_big_file_threshold(istate->repo)) ||
> type != OBJ_BLOB ||
> - (path && would_convert_to_git(istate, path))) {
> + (path && would_convert_to_git(istate, path)) ||
> + !(flags & INDEX_WRITE_OBJECT)) {
> ret = index_core(istate, oid, fd, xsize_t(st->st_size),
> type, path, flags);
> } else {
>
> Luca.
That looks good, almost exactly what I was about to send. I was
mistaken— there isn’t a hash_write_object flag after all ;-)
It looks like this is your first time posting on the Git mailing list.
Would you consider contributing this (as a patch)?
Thanks! Yuchen
next prev parent reply other threads:[~2026-04-04 17:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-04 10:39 [BUG] git diff --no-index segfaults on large files (NULL object database) Luca Stefani
2026-04-04 16:45 ` Tian Yuchen
2026-04-04 16:53 ` Luca Stefani
2026-04-04 17:07 ` Tian Yuchen [this message]
2026-04-04 23:09 ` Jeff King
2026-04-05 2:48 ` Tian Yuchen
2026-04-05 6:14 ` Jeff King
2026-04-06 17:57 ` Justin Tobler
2026-04-06 20:45 ` 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=4be492cf-347b-4fa5-9bdd-83e7ea8abd92@malon.dev \
--to=cat@malon.dev \
--cc=git@vger.kernel.org \
--cc=luca.stefani.ge1@gmail.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