Re: [PATCH v7 17/22] commit-graph: verify contents match checksum

2018-06-27 Thread Junio C Hamano
Derrick Stolee writes: > + devnull = open("/dev/null", O_WRONLY); > + f = hashfd(devnull, NULL); > + hashwrite(f, g->data, g->data_len - g->hash_len); I wondered if we can hide the knowledge of "/dev/null" by reusing hashfd_check() from csum-file.c (which is used by the verification

[PATCH v7 17/22] commit-graph: verify contents match checksum

2018-06-27 Thread Derrick Stolee
The commit-graph file ends with a SHA1 hash of the previous contents. If a commit-graph file has errors but the checksum hash is correct, then we know that the problem is a bug in Git and not simply file corruption after-the-fact. Compute the checksum right away so it is the first error that appea