X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=fsck-cache.c;h=c35acaa82c93824f952327e12727d0c92edc5bd7;hb=d6d3f9d0125a7215f3cdc2600b2307ca55b69536;hp=ac348b7d5278e9d04e3a1cd417389379c32b014f;hpb=16d4d1ba6c1de7a414a6826eb6f363d4b20345bf;p=git.git diff --git a/fsck-cache.c b/fsck-cache.c index ac348b7d..c35acaa8 100644 --- a/fsck-cache.c +++ b/fsck-cache.c @@ -20,15 +20,25 @@ static int mark_sha1_seen(unsigned char *sha1, char *tag) static int fsck_tree(unsigned char *sha1, void *data, unsigned long size) { + int warn_old_tree = 1; + while (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; + + /* Warn about trees that don't do the recursive thing.. */ + if (warn_old_tree && strchr(path, '/')) { + fprintf(stderr, "warning: fsck-cache: tree %s has full pathnames in it\n", sha1_to_hex(sha1)); + warn_old_tree = 0; + } + 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; }