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

Function find_containing_dir

refs/ref-cache.c:179–195  ·  view source on GitHub ↗

* If refname is a reference name, find the ref_dir within the dir * tree that should hold refname. If refname is a directory name * (i.e., it ends in '/'), then return that ref_dir itself. dir must * represent the top-level directory and must already be complete. * Sort ref_dirs and recurse into subdirectories as necessary. Will * return NULL if the desired directory cannot be found. */

Source from the content-addressed store, hash-verified

177 * return NULL if the desired directory cannot be found.
178 */
179static struct ref_dir *find_containing_dir(struct ref_dir *dir,
180 const char *refname)
181{
182 const char *slash;
183 for (slash = strchr(refname, '/'); slash; slash = strchr(slash + 1, '/')) {
184 size_t dirnamelen = slash - refname + 1;
185 struct ref_dir *subdir;
186 subdir = search_for_subdir(dir, refname, dirnamelen);
187 if (!subdir) {
188 dir = NULL;
189 break;
190 }
191 dir = subdir;
192 }
193
194 return dir;
195}
196
197/*
198 * Emit a warning and return true iff ref1 and ref2 have the same name

Callers 1

Calls 1

search_for_subdirFunction · 0.85

Tested by

no test coverage detected