| 212 | } |
| 213 | |
| 214 | int hashfile_truncate(struct hashfile *f, struct hashfile_checkpoint *checkpoint) |
| 215 | { |
| 216 | off_t offset = checkpoint->offset; |
| 217 | |
| 218 | if (ftruncate(f->fd, offset) || |
| 219 | lseek(f->fd, offset, SEEK_SET) != offset) |
| 220 | return -1; |
| 221 | f->total = offset; |
| 222 | git_hash_clone(&f->ctx, &checkpoint->ctx); |
| 223 | f->offset = 0; /* hashflush() was called in checkpoint */ |
| 224 | return 0; |
| 225 | } |
| 226 | |
| 227 | void crc32_begin(struct hashfile *f) |
| 228 | { |
no test coverage detected