MCPcopy Index your code
hub / github.com/git/git / invalidate_one_component

Function invalidate_one_component

dir.c:3993–4013  ·  view source on GitHub ↗

* Normally when an entry is added or removed from a directory, * invalidating that directory is enough. No need to touch its * ancestors. When a directory is shown as "foo/bar/" in git-status * however, deleting or adding an entry may have cascading effect. * * Say the "foo/bar/file" has become untracked, we need to tell the * untracked_cache_dir of "foo" that "bar/" is not an untracked * d

Source from the content-addressed store, hash-verified

3991 * stick to something safe and simple.
3992 */
3993static int invalidate_one_component(struct untracked_cache *uc,
3994 struct untracked_cache_dir *dir,
3995 const char *path, int len)
3996{
3997 const char *rest = strchr(path, '/');
3998
3999 if (rest) {
4000 int component_len = rest - path;
4001 struct untracked_cache_dir *d =
4002 lookup_untracked(uc, dir, path, component_len);
4003 int ret =
4004 invalidate_one_component(uc, d, rest + 1,
4005 len - (component_len + 1));
4006 if (ret)
4007 invalidate_one_directory(uc, dir);
4008 return ret;
4009 }
4010
4011 invalidate_one_directory(uc, dir);
4012 return uc->dir_flags & DIR_SHOW_OTHER_DIRECTORIES;
4013}
4014
4015void untracked_cache_invalidate_path(struct index_state *istate,
4016 const char *path, int safe_path)

Callers 1

Calls 2

lookup_untrackedFunction · 0.85
invalidate_one_directoryFunction · 0.85

Tested by

no test coverage detected