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

Function renormalize_tracked_files

builtin/add.c:73–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73static 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
99static char *prune_directory(struct repository *repo,
100 struct dir_struct *dir,

Callers 1

cmd_addFunction · 0.85

Calls 3

path_in_sparse_checkoutFunction · 0.85
ce_path_matchFunction · 0.85
add_file_to_indexFunction · 0.85

Tested by

no test coverage detected