summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-08-07 21:40:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-10 18:10:37 (GMT)
commitcb5add58681db299d22cdccd898f9924e740034a (patch)
tree3bd7c862331cc61bff36e4476b4df2a1dd066ac9 /sha1_file.c
parent282616c72d1d08a77ca4fe1186cb708c38408d87 (diff)
downloadgit-cb5add58681db299d22cdccd898f9924e740034a.zip
git-cb5add58681db299d22cdccd898f9924e740034a.tar.gz
git-cb5add58681db299d22cdccd898f9924e740034a.tar.bz2
sha1_file.c: rename move_temp_to_file() to finalize_object_file()
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. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sha1_file.c b/sha1_file.c
index a38854c..da22a12 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2784,11 +2784,8 @@ static void write_sha1_file_prepare(const void *buf, unsigned long len,
/*
* Move the just written object into its final resting place.
- * 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.
*/
-int move_temp_to_file(const char *tmpfile, const char *filename)
+int finalize_object_file(const char *tmpfile, const char *filename)
{
int ret = 0;
@@ -2962,7 +2959,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
tmp_file, strerror(errno));
}
- return move_temp_to_file(tmp_file, filename);
+ return finalize_object_file(tmp_file, filename);
}
int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *returnsha1)