Re: [PATCH v2 3/4] loose: lift loose object index writing logic into helper

From
Justin Tobler <hidden>
Date
2026-10-29 21:18:53
Reply to
Patrick Steinhardt, 2026-10-29
On 26/10/29 09:05AM, Patrick Steinhardt wrote:
On Wed, Oct 28, 2026 at 07:24:12PM -0500, Justin Tobler wrote:
quoted
-int repo_write_loose_object_map(struct repository *repo)
+static int loose_object_map_write(struct repository *repo,
+				  struct loose_object_map *loose_map, int fd)
Curious that you're using a file descriptor instead of a path as you did
in the preceding commit. But I guess that's because of how we first have
to lock the file, which we of course don't have to do on the writing
side.
That is correct. When we lock the file, it gives us back the file
descriptor back for the lockfile. I decided to use the file descriptor
here because it was readily available to pass around.
I guess we could've also moved locking into this function here to make
both interfaces match, but maybe the next commit will give a hint why we
don't.
Yup, this becomes more apparent in the next commit, but we don't want to
acquire the lock in the helper, so that callers can lock the file prior
to reading any preexisting version to get a consistent view. I may leave
a note about this in the next versions commit message.

-Justin
Thread (34 messages) 34 messages, 4 authors, last reply 3d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help