Thread View: linux.kernel.git
1 messages
1 total messages
Started by Junio C Hamano
Wed, 04 Nov 2026 17:47
Re: [PATCH 2/2] odb/source-loose: fix existence checks for newly written objects
Author: Junio C Hamano
Date: Wed, 04 Nov 2026 17:47
Date: Wed, 04 Nov 2026 17:47
45 lines
14173 bytes
14173 bytes
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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads