ls-tree: further tweaks of the rewrite
[gitweb.git] / tar-tree.c
index 2716ae3eb1430abfc43d980d904fc192f8dcbbf4..970c4bb54e148282a89f1249a96deca880bccafd 100644 (file)
@@ -353,6 +353,8 @@ static void traverse_tree(void *buffer, unsigned long size,
 
                if (size < namelen + 20 || sscanf(buffer, "%o", &mode) != 1)
                        die("corrupt 'tree' file");
+               if (S_ISDIR(mode) || S_ISREG(mode))
+                       mode |= (mode & 0100) ? 0777 : 0666;
                buffer = sha1 + 20;
                size -= namelen + 20;