From: Junio C Hamano Date: Wed, 19 Aug 2015 21:48:55 +0000 (-0700) Subject: Merge branch 'jc/finalize-temp-file' X-Git-Tag: v2.6.0-rc0~58 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/51a22ce1477b991793c20d3143d72f0ae6e38c76 Merge branch 'jc/finalize-temp-file' Long overdue micro clean-up. * jc/finalize-temp-file: sha1_file.c: rename move_temp_to_file() to finalize_object_file() --- 51a22ce1477b991793c20d3143d72f0ae6e38c76 diff --cc sha1_file.c index 1cee438422,da22a120cb..1081b95713 --- a/sha1_file.c +++ b/sha1_file.c @@@ -3085,29 -2959,12 +3082,29 @@@ static int write_loose_object(const uns 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) +static int freshen_loose_object(const unsigned char *sha1) +{ + return check_and_freshen(sha1, 1); +} + +static int freshen_packed_object(const unsigned char *sha1) +{ + struct pack_entry e; + if (!find_pack_entry(sha1, &e)) + return 0; + if (e.p->freshened) + return 1; + if (!freshen_file(e.p->pack_name)) + return 0; + e.p->freshened = 1; + return 1; +} + +int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *sha1) { - unsigned char sha1[20]; char hdr[32]; int hdrlen;