This is meant to force the creation of a loose object even if it
already exists packed. Needed for the next commit.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Nicolas Pitre17 years agocommitted byJunio C Hamano
@ -2182,9 +2172,53 @@ int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned cha
@@ -2182,9 +2172,53 @@ int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned cha
die("unable to write sha1 file");
free(compressed);
if (mtime) {
struct utimbuf utb;
utb.actime = mtime;
utb.modtime = mtime;
if (utime(tmpfile, &utb) < 0)
warning("failed utime() on %s: %s",
tmpfile, strerror(errno));
}
return move_temp_to_file(tmpfile, filename);
}
int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned char *returnsha1)
{
unsigned char sha1[20];
char hdr[32];
int hdrlen;
/* Normally if we have it in the pack then we do not bother writing