git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 3 in “sha1_file.c: rename move_temp_to_file() to finalize_temp_file()”
  1. sha1_file.c: rename move_temp_to_file() to finalize_temp_file()Junio C Hamano, Aug 8, 2015
  2. Jeff KingAug 8, 2015
  3. Junio C HamanoAug 10, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.