| 40 | static const char *pathspec_from_file; |
| 41 | |
| 42 | static int chmod_pathspec(struct repository *repo, |
| 43 | struct pathspec *pathspec, |
| 44 | char flip, |
| 45 | int show_only) |
| 46 | { |
| 47 | int ret = 0; |
| 48 | |
| 49 | for (size_t i = 0; i < repo->index->cache_nr; i++) { |
| 50 | struct cache_entry *ce = repo->index->cache[i]; |
| 51 | int err; |
| 52 | |
| 53 | if (!include_sparse && |
| 54 | (ce_skip_worktree(ce) || |
| 55 | !path_in_sparse_checkout(ce->name, repo->index))) |
| 56 | continue; |
| 57 | |
| 58 | if (pathspec && !ce_path_match(repo->index, ce, pathspec, NULL)) |
| 59 | continue; |
| 60 | |
| 61 | if (!show_only) |
| 62 | err = chmod_index_entry(repo->index, ce, flip); |
| 63 | else |
| 64 | err = S_ISREG(ce->ce_mode) ? 0 : -1; |
| 65 | |
| 66 | if (err < 0) |
| 67 | ret = error(_("cannot chmod %cx '%s'"), flip, ce->name); |
| 68 | } |
| 69 | |
| 70 | return ret; |
| 71 | } |
| 72 | |
| 73 | static int renormalize_tracked_files(struct repository *repo, |
| 74 | const struct pathspec *pathspec, |
no test coverage detected