Re: [PATCH] sha1_file.c: rename move_temp_to_file() to finalize_temp_file()
- From
Jeff King <peff@peff.net>
- Date
- Aug 8, 2015, 09:12 UTC
- Message-ID
- <20150808091222.GA24707@sigill.intra.peff.net>
- In-Reply-To
- <xmqqh9oawrsy.fsf@gitster.dls.corp.google.com>
On Fri, Aug 07, 2015 at 05:24:29PM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> Since 5a688fe4 ("core.sharedrepository = 0mode" should set, not
> loosen, 2009-03-25), we kept reminding ourselves:
>
> NEEDSWORK: this should be renamed to finalize_temp_file() as
> "moving" is only a part of what it does, when no patch between
> master to pu changes the call sites of this function.
>
> without doing anything about it. Let's do so.
>
> The purpose of this function was not to move but to finalize. The
> detail of the primarily implementation of finalizing was to link the
> temporary file to its final name and then to unlink, which wasn't
> even "moving". The alternative implementation did "move" by calling
> rename(2), which is a fun tangent.This is definitely a better name. But while we are touching the area, my other pet peeve about this function is that it is really specific to moving _object_ temp files around. It started life as static-local to sha1-file.c, so not mentioning objects is OK, but when it became a global, it's a bit confusing.
Maybe finalize_object_file() would be a better name?
-Peff