summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 23:18:48 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 23:18:48 (GMT)
commit42ea9cb286423c949d42ad33823a5221182f84bf (patch)
tree599757cc3e6a2bf3ab29d22246662460c1537393 /tree.c
parentd5a72fd622ecedaea272cd6292abb7138a49e460 (diff)
downloadgit-42ea9cb286423c949d42ad33823a5221182f84bf.zip
git-42ea9cb286423c949d42ad33823a5221182f84bf.tar.gz
git-42ea9cb286423c949d42ad33823a5221182f84bf.tar.bz2
Be more careful about tree entry modes.
The tree object parsing used to get the executable bit wrong, and didn't know about symlinks. Also, fsck really wants the full mode value so that it can verify the other bits for sanity, so save it all in struct tree_entry.
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tree.c b/tree.c
index 4a26603..468f99e 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;