Subject: Re: [PATCH] sparse-checkout: use fdopen_lock_file() instead of xfdopen()

From: Junio C Hamano <[email-masked]>
Date: Thu, 05 Sep 2024 08:16:05 -0700

Jeff King <[email-masked]> writes:

> We do have to adjust the code a bit:
>
>   - we have to handle errors ourselves; we can just die(), since that's
>     what xfdopen() would have done (and we can even provide a more
>     specific error message).
>
>   - we no longer need to call fflush(); committing the lock-file
>     auto-closes it, which will now do the flush for us. As a bonus, this
>     will actually check that the flush was successful before renaming
>     the file into place. Let's likewise report when committing the lock
>     fails (rather than quietly returning success from the command).
>
>   - we can get rid of the local "fd" variable, since we never look at it
>     ourselves now

OK.  The neessary change is surprisingly small.

> I found this because I was building git on an Android system,...

Sounds like fun.

Will queue.  Thanks.