From e18088451d92fbf83bfb57fd48201eda117f8103 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 26 Jun 2005 22:01:46 -0700 Subject: csum-file interface updates: return resulting SHA1 Also, make the writing of the SHA1 as a end-header be conditional: not every user will necessarily want to write the SHA1 to the file itself, even though current users do (but we migh end up using the same helper functions for the object files themselves, that don't do this). This also makes the packed index file contain the SHA1 of the packed data file at the end (just before its own SHA1). That way you can validate the pairing of the two if you want to. --- unpack-objects.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'unpack-objects.c') diff --git a/unpack-objects.c b/unpack-objects.c index 91a71c55c6..a792b92ece 100644 --- a/unpack-objects.c +++ b/unpack-objects.c @@ -74,9 +74,10 @@ static int check_index(void) * Total size: * - 256 index entries 4 bytes each * - 24-byte entries * nr (20-byte sha1 + 4-byte offset) + * - 20-byte SHA1 of the packfile * - 20-byte SHA1 file checksum */ - if (index_size != 4*256 + nr * 24 + 20) + if (index_size != 4*256 + nr * 24 + 20 + 20) return error("wrong index file size"); nr_entries = nr; -- cgit v1.2.1