Instead of looping over the entries and writing out, use a
separate loop after all entries have been written out to check
how many entries are racily clean. Make sure that the newly
created index file gets the right timestamp when we check by
flushing the buffered data by ce_write().
Signed-off-by: Junio C Hamano <junkio@cox.net>
static int ce_write_flush(SHA_CTX *context, int fd)
{
unsigned int buffered = write_buffer_len;
if (buffered) {
SHA1_Update(context, write_buffer, buffered);
if (write(fd, write_buffer, buffered) != buffered)
return -1;
write_buffer_len = 0;
}
return 0;
}
static int ce_write(SHA_CTX *context, int fd, void *data, unsigned int len)
{
while (len) {
@ -851,8 +863,8 @@ static int ce_write(SHA_CTX *context, int fd, void *data, unsigned int len)
@@ -851,8 +863,8 @@ static int ce_write(SHA_CTX *context, int fd, void *data, unsigned int len)