From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, Patrick Ohly <patrick.ohly@intel.com>
Subject: Re: [PATCH 2/2] odb/source-loose: fix existence checks for newly written objects
Date: Wed, 04 Nov 2026 09:47:49 -0800 [thread overview]
Message-ID: <xmqqfqxg32uy.fsf@gitster.g> (raw)
In-Reply-To: <20261104-pks-odb-loose-stale-cache-v1-2-a00d5cdb5e7d@pks.im> (Patrick Steinhardt's message of "Wed, 04 Nov 2026 13:16:35 +0100")
Patrick Steinhardt <ps@pks.im> writes:
> @@ -824,8 +837,13 @@ static int write_loose_object(struct odb_source_loose *loose,
> warning_errno(_("failed utime() on %s"), tmp_file.buf);
> }
>
> - return finalize_object_file_flags(loose->base.odb->repo, tmp_file.buf, filename.buf,
> - FOF_SKIP_COLLISION_CHECK);
> + ret = finalize_object_file_flags(loose->base.odb->repo, tmp_file.buf, filename.buf,
> + FOF_SKIP_COLLISION_CHECK);
> + if (ret < 0)
> + return ret;
> +
> + loose_cache_mark_seen(loose, oid);
> + return 0;
> }
>
> static int odb_source_loose_write_object(struct odb_source *source,
> @@ -967,8 +985,14 @@ static int odb_source_loose_write_object_stream(struct odb_source *source,
>
> err = finalize_object_file_flags(loose->base.odb->repo, tmp_file.buf, filename.buf,
> FOF_SKIP_COLLISION_CHECK);
> - if (!err && compat)
> + if (err < 0)
> + goto cleanup;
> +
> + loose_cache_mark_seen(loose, oid);
> +
> + if (compat)
> err = repo_add_loose_object_map(loose, oid, &compat_oid);
> +
> cleanup:
> strbuf_release(&tmp_file);
> strbuf_release(&filename);
Not about this change but the lack of "if (compat)" stuff in the
previous hunk puzzled me. It turns out that the logic to write a
single loose object is so big that write_loose_object(), which is
the subject of the previous hunk, helps another function,
odb_source_loose_write_object(), by being its helper function, and
this caller has the corresponding "if (compat)" logic to produce
the hash interoperability data.
Looking very good.
next prev parent reply other threads:[~2026-11-04 17:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 12:16 [PATCH 0/2] odb/source-loose: fix failing existence checks caused by stale cache Patrick Steinhardt
2026-11-04 12:16 ` [PATCH 1/2] odb/source-loose: extract logic to retrieve subdirectory bitmap Patrick Steinhardt
2026-11-04 12:16 ` [PATCH 2/2] odb/source-loose: fix existence checks for newly written objects Patrick Steinhardt
2026-11-04 17:47 ` Junio C Hamano [this message]
2026-11-05 19:43 ` Jeff King
2026-11-06 11:16 ` Patrick Steinhardt
2026-11-06 16:02 ` Junio C Hamano
2026-11-04 12:57 ` [PATCH 0/2] odb/source-loose: fix failing existence checks caused by stale cache Kristofer Karlsson
2026-11-04 16:27 ` Derrick Stolee
2026-11-05 0:09 ` 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=xmqqfqxg32uy.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=patrick.ohly@intel.com \
--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.