MCPcopy Create free account
hub / github.com/git/git / chmod_pathspec

Function chmod_pathspec

builtin/add.c:42–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40static const char *pathspec_from_file;
41
42static 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
73static int renormalize_tracked_files(struct repository *repo,
74 const struct pathspec *pathspec,

Callers 1

cmd_addFunction · 0.85

Calls 4

path_in_sparse_checkoutFunction · 0.85
ce_path_matchFunction · 0.85
chmod_index_entryFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected