aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fsck-cache.c22
-rw-r--r--tree.c6
-rw-r--r--tree.h2
3 files changed, 28 insertions, 2 deletions
diff --git a/fsck-cache.c b/fsck-cache.c
index 301cc67b7..abdec92ff 100644
--- a/fsck-cache.c
+++ b/fsck-cache.c
@@ -100,6 +100,28 @@ static int fsck_tree(struct tree *item)
if (strchr(entry->name, '/'))
has_full_path = 1;
+ switch (entry->mode) {
+ /*
+ * Standard modes..
+ */
+ case S_IFREG | 0755:
+ case S_IFREG | 0644:
+ case S_IFLNK:
+ case S_IFDIR:
+ break;
+ /*
+ * This is nonstandard, but we had a few of these
+ * early on when we honored the full set of mode
+ * bits..
+ */
+ case S_IFREG | 0664:
+ break;
+ default:
+ printf("tree %s has entry %o %s\n",
+ sha1_to_hex(item->object.sha1),
+ entry->mode, entry->name);
+ }
+
if (last) {
if (verify_ordered(last, entry) < 0) {
fprintf(stderr, "tree %s not ordered\n",
diff --git a/tree.c b/tree.c
index 4a26603f6..468f99e49 100644
--- a/tree.c
+++ b/tree.c
@@ -122,8 +122,10 @@ int parse_tree(struct tree *item)
entry = xmalloc(sizeof(struct tree_entry_list));
entry->name = strdup(path + 1);
- entry->directory = S_ISDIR(mode);
- entry->executable = mode & S_IXUSR;
+ entry->directory = S_ISDIR(mode) != 0;
+ entry->executable = (mode & S_IXUSR) != 0;
+ entry->symlink = S_ISLNK(mode) != 0;
+ entry->mode = mode;
entry->next = NULL;
bufptr += len + 20;
diff --git a/tree.h b/tree.h
index 96cf4291d..e1c94c090 100644
--- a/tree.h
+++ b/tree.h
@@ -9,6 +9,8 @@ struct tree_entry_list {
struct tree_entry_list *next;
unsigned directory : 1;
unsigned executable : 1;
+ unsigned symlink : 1;
+ unsigned int mode;
char *name;
union {
struct tree *tree;