| 204 | } |
| 205 | |
| 206 | static unsigned int st_mode_from_ce(const struct cache_entry *ce) |
| 207 | { |
| 208 | extern int trust_executable_bit, has_symlinks; |
| 209 | |
| 210 | switch (ce->ce_mode & S_IFMT) { |
| 211 | case S_IFLNK: |
| 212 | return has_symlinks ? S_IFLNK : (S_IFREG | 0644); |
| 213 | case S_IFREG: |
| 214 | return (ce->ce_mode & (trust_executable_bit ? 0755 : 0644)) | S_IFREG; |
| 215 | case S_IFGITLINK: |
| 216 | return S_IFDIR | 0755; |
| 217 | case S_IFDIR: |
| 218 | return ce->ce_mode; |
| 219 | default: |
| 220 | BUG("unsupported ce_mode: %o", ce->ce_mode); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | int fake_lstat(const struct cache_entry *ce, struct stat *st) |
| 225 | { |