tree-walk: be more specific about corrupt tree errors
[gitweb.git] / tree-walk.c
index ce278424391b03d1d4e41eb3fc14750f70908fe5..24f9a0f14a95b55f0d50534b2f0300b3178b6aa2 100644 (file)
@@ -27,12 +27,14 @@ static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned
        const char *path;
        unsigned int mode, len;
 
-       if (size < 24 || buf[size - 21])
-               die("corrupt tree file");
+       if (size < 23 || buf[size - 21])
+               die(_("too-short tree object"));
 
        path = get_mode(buf, &mode);
-       if (!path || !*path)
-               die("corrupt tree file");
+       if (!path)
+               die(_("malformed mode in tree entry for tree"));
+       if (!*path)
+               die(_("empty filename in tree entry for tree"));
        len = strlen(path) + 1;
 
        /* Initialize the descriptor entry */
@@ -81,7 +83,7 @@ void update_tree_entry(struct tree_desc *desc)
        unsigned long len = end - (const unsigned char *)buf;
 
        if (size < len)
-               die("corrupt tree file");
+               die(_("too-short tree file"));
        buf = end;
        size -= len;
        desc->buffer = buf;