summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aa16021)
raw | patch | inline | side by side (parent: aa16021)
author | Junio C Hamano <junkio@cox.net> | |
Fri, 10 Jun 2005 08:32:37 +0000 (01:32 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Fri, 10 Jun 2005 14:42:45 +0000 (07:42 -0700) |
When we choose to omit deleted entries, we should subtract
numbers of such entries from the total number in the header.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Oops.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
numbers of such entries from the total number in the header.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Oops.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
read-cache.c | patch | blob | history |
diff --git a/read-cache.c b/read-cache.c
index d358933b26991408268c40c428eee75333793582..e9618f0914b36a4d1bd60785e53ad484e8748e36 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
{
SHA_CTX c;
struct cache_header hdr;
- int i;
+ int i, removed;
+
+ for (i = removed = 0; i < entries; i++)
+ if (!cache[i]->ce_mode)
+ removed++;
hdr.hdr_signature = htonl(CACHE_SIGNATURE);
hdr.hdr_version = htonl(2);
- hdr.hdr_entries = htonl(entries);
+ hdr.hdr_entries = htonl(entries - removed);
SHA1_Init(&c);
if (ce_write(&c, newfd, &hdr, sizeof(hdr)) < 0)