Skip to content

Commit 1843d8d

Browse files
René Scharfegitster
authored andcommitted
cleanup unpack-trees.c: shrink struct tree_entry_list
Remove the two write-only fields executable and symlink from struct tree_entry_list. Also replace usage of the field directory with S_ISDIR checks on the mode field, and then remove this now obsolete field, too. Noticed by David Kastrup. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 24d0063 commit 1843d8d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

unpack-trees.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111

1212
struct tree_entry_list {
1313
struct tree_entry_list *next;
14-
unsigned directory : 1;
15-
unsigned executable : 1;
16-
unsigned symlink : 1;
1714
unsigned int mode;
1815
const char *name;
1916
const unsigned char *sha1;
@@ -38,9 +35,6 @@ static struct tree_entry_list *create_tree_entry_list(struct tree *tree)
3835
entry->name = one.path;
3936
entry->sha1 = one.sha1;
4037
entry->mode = one.mode;
41-
entry->directory = S_ISDIR(one.mode) != 0;
42-
entry->executable = (one.mode & S_IXUSR) != 0;
43-
entry->symlink = S_ISLNK(one.mode) != 0;
4438
entry->next = NULL;
4539

4640
*list_p = entry;
@@ -141,9 +135,9 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len,
141135
#endif
142136
if (!first || entcmp(first, firstdir,
143137
posns[i]->name,
144-
posns[i]->directory) > 0) {
138+
S_ISDIR(posns[i]->mode)) > 0) {
145139
first = posns[i]->name;
146-
firstdir = posns[i]->directory;
140+
firstdir = S_ISDIR(posns[i]->mode);
147141
}
148142
}
149143
/* No name means we're done */
@@ -177,7 +171,7 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len,
177171
continue;
178172
}
179173

180-
if (posns[i]->directory) {
174+
if (S_ISDIR(posns[i]->mode)) {
181175
struct tree *tree = lookup_tree(posns[i]->sha1);
182176
any_dirs = 1;
183177
parse_tree(tree);

0 commit comments

Comments
 (0)