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

Function fill_directory

dir.c:272–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272int fill_directory(struct dir_struct *dir,
273 struct index_state *istate,
274 const struct pathspec *pathspec)
275{
276 const char *prefix;
277 size_t prefix_len;
278
279 unsigned exclusive_flags = DIR_SHOW_IGNORED | DIR_SHOW_IGNORED_TOO;
280 if ((dir->flags & exclusive_flags) == exclusive_flags)
281 BUG("DIR_SHOW_IGNORED and DIR_SHOW_IGNORED_TOO are exclusive");
282
283 /*
284 * Calculate common prefix for the pathspec, and
285 * use that to optimize the directory walk
286 */
287 prefix_len = common_prefix_len(pathspec);
288 prefix = prefix_len ? pathspec->items[0].match : "";
289
290 /* Read the directory and prune it */
291 read_directory(dir, istate, prefix, prefix_len, pathspec);
292
293 return prefix_len;
294}
295
296int within_depth(const char *name, int namelen,
297 int depth, int max_depth)

Callers 8

get_untracked_filesFunction · 0.85
grep_directoryFunction · 0.85
get_untracked_filesFunction · 0.85
show_filesFunction · 0.85
cmd_addFunction · 0.85
cmd_cleanFunction · 0.85

Calls 2

common_prefix_lenFunction · 0.85
read_directoryFunction · 0.85

Tested by

no test coverage detected