| 2569 | } |
| 2570 | |
| 2571 | static int open_cached_dir(struct cached_dir *cdir, |
| 2572 | struct dir_struct *dir, |
| 2573 | struct untracked_cache_dir *untracked, |
| 2574 | struct index_state *istate, |
| 2575 | struct strbuf *path, |
| 2576 | int check_only) |
| 2577 | { |
| 2578 | const char *c_path; |
| 2579 | |
| 2580 | memset(cdir, 0, sizeof(*cdir)); |
| 2581 | cdir->untracked = untracked; |
| 2582 | if (valid_cached_dir(dir, untracked, istate, path, check_only)) |
| 2583 | return 0; |
| 2584 | c_path = path->len ? path->buf : "."; |
| 2585 | cdir->fdir = opendir(c_path); |
| 2586 | if (!cdir->fdir) |
| 2587 | warning_errno(_("could not open directory '%s'"), c_path); |
| 2588 | if (dir->untracked) { |
| 2589 | invalidate_directory(dir->untracked, untracked); |
| 2590 | dir->untracked->dir_opened++; |
| 2591 | } |
| 2592 | if (!cdir->fdir) |
| 2593 | return -1; |
| 2594 | return 0; |
| 2595 | } |
| 2596 | |
| 2597 | static int read_cached_dir(struct cached_dir *cdir) |
| 2598 | { |
no test coverage detected