diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-09 15:36:41 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-09 15:36:41 -0700 |
commit | f768846e34997fb847c9b875615867d4716d632f (patch) | |
tree | 5f3fcd81f68f4031cbcfcadd5c368104ca0969a0 /fsck-cache.c | |
parent | 16d4d1ba6c1de7a414a6826eb6f363d4b20345bf (diff) | |
download | git-f768846e34997fb847c9b875615867d4716d632f.tar.gz git-f768846e34997fb847c9b875615867d4716d632f.tar.xz |
Teach "fsck" and "read-tree" about recursive tree-nodes.
This is totally untested, since we can't actually _write_ things that
way yet, but I'll get to that next, I hope. That should fix the
huge wasted space for kernel-sized tree objects.
Diffstat (limited to 'fsck-cache.c')
-rw-r--r-- | fsck-cache.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fsck-cache.c b/fsck-cache.c index ac348b7d5..1123b6b7e 100644 --- a/fsck-cache.c +++ b/fsck-cache.c @@ -24,11 +24,12 @@ static int fsck_tree(unsigned char *sha1, void *data, unsigned long size) int len = 1+strlen(data); unsigned char *file_sha1 = data + len; char *path = strchr(data, ' '); - if (size < len + 20 || !path) + unsigned int mode; + if (size < len + 20 || !path || sscanf(data, "%o", &mode) != 1) return -1; data += len + 20; size -= len + 20; - mark_needs_sha1(sha1, "blob", file_sha1); + mark_needs_sha1(sha1, S_ISDIR(mode) ? "tree" : "blob", file_sha1); } return 0; } |