summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: abeb40e)
raw | patch | inline | side by side (parent: abeb40e)
author | Nicolas Pitre <nico@cam.org> | |
Fri, 29 Aug 2008 20:08:00 +0000 (16:08 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 30 Aug 2008 04:51:27 +0000 (21:51 -0700) |
When limiting the pack size, a new header has to be written to the
pack and a new SHA1 computed. Make sure that the SHA1 of what is being
read back matches the SHA1 of what was written.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack and a new SHA1 computed. Make sure that the SHA1 of what is being
read back matches the SHA1 of what was written.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c | patch | blob | history | |
csum-file.c | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 501f9367cb81b3eacce6ef0499a0d0858c6a2843..a02c673fb7b6a50278b632e6bd127dac0d03168a 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
} else if (nr_written == nr_remaining) {
sha1close(f, sha1, CSUM_FSYNC);
} else {
- int fd = sha1close(f, NULL, 0);
+ int fd = sha1close(f, sha1, 0);
fixup_pack_header_footer(fd, sha1, pack_tmp_name,
- nr_written, NULL, 0);
+ nr_written, sha1, offset);
close(fd);
}
diff --git a/csum-file.c b/csum-file.c
index ace64f165e4a01fb99892e9b89e7df791a7f4ca1..28389541a32454f2d988bb02e4268ffe12755bbc 100644 (file)
--- a/csum-file.c
+++ b/csum-file.c
sha1flush(f, offset);
f->offset = 0;
}
+ SHA1_Final(f->buffer, &f->ctx);
+ if (result)
+ hashcpy(result, f->buffer);
if (flags & (CSUM_CLOSE | CSUM_FSYNC)) {
/* write checksum and close fd */
- SHA1_Final(f->buffer, &f->ctx);
- if (result)
- hashcpy(result, f->buffer);
sha1flush(f, 20);
if (flags & CSUM_FSYNC)
fsync_or_die(f->fd, f->name);