Don't try to determine whether the system supports file modes when putting the tree data in the index during checkout. The tree's mode is canonical and did not come from stat(2) in the first place.