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

Function treat_path_fast

dir.c:2389–2424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2387}
2388
2389static enum path_treatment treat_path_fast(struct dir_struct *dir,
2390 struct cached_dir *cdir,
2391 struct index_state *istate,
2392 struct strbuf *path,
2393 int baselen,
2394 const struct pathspec *pathspec)
2395{
2396 /*
2397 * WARNING: From this function, you can return path_recurse or you
2398 * can call read_directory_recursive() (or neither), but
2399 * you CAN'T DO BOTH.
2400 */
2401 strbuf_setlen(path, baselen);
2402 if (!cdir->ucd) {
2403 strbuf_addstr(path, cdir->file);
2404 return path_untracked;
2405 }
2406 strbuf_addstr(path, cdir->ucd->name);
2407 /* treat_one_path() does this before it calls treat_directory() */
2408 strbuf_complete(path, '/');
2409 if (cdir->ucd->check_only)
2410 /*
2411 * check_only is set as a result of treat_directory() getting
2412 * to its bottom. Verify again the same set of directories
2413 * with check_only set.
2414 */
2415 return read_directory_recursive(dir, istate, path->buf, path->len,
2416 cdir->ucd, 1, 0, pathspec);
2417 /*
2418 * We get path_recurse in the first run when
2419 * directory_exists_in_index() returns index_nonexistent. We
2420 * are sure that new changes in the index does not impact the
2421 * outcome. Return now.
2422 */
2423 return path_recurse;
2424}
2425
2426static enum path_treatment treat_path(struct dir_struct *dir,
2427 struct untracked_cache_dir *untracked,

Callers 1

treat_pathFunction · 0.85

Calls 4

strbuf_setlenFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_completeFunction · 0.85
read_directory_recursiveFunction · 0.85

Tested by

no test coverage detected