| 71 | } |
| 72 | |
| 73 | static int renormalize_tracked_files(struct repository *repo, |
| 74 | const struct pathspec *pathspec, |
| 75 | int flags) |
| 76 | { |
| 77 | int retval = 0; |
| 78 | |
| 79 | for (size_t i = 0; i < repo->index->cache_nr; i++) { |
| 80 | struct cache_entry *ce = repo->index->cache[i]; |
| 81 | |
| 82 | if (!include_sparse && |
| 83 | (ce_skip_worktree(ce) || |
| 84 | !path_in_sparse_checkout(ce->name, repo->index))) |
| 85 | continue; |
| 86 | if (ce_stage(ce)) |
| 87 | continue; /* do not touch unmerged paths */ |
| 88 | if (!S_ISREG(ce->ce_mode) && !S_ISLNK(ce->ce_mode)) |
| 89 | continue; /* do not touch non blobs */ |
| 90 | if (pathspec && !ce_path_match(repo->index, ce, pathspec, NULL)) |
| 91 | continue; |
| 92 | retval |= add_file_to_index(repo->index, ce->name, |
| 93 | flags | ADD_CACHE_RENORMALIZE); |
| 94 | } |
| 95 | |
| 96 | return retval; |
| 97 | } |
| 98 | |
| 99 | static char *prune_directory(struct repository *repo, |
| 100 | struct dir_struct *dir, |
no test coverage detected