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

Function index_name_is_other

read-cache.c:3442–3459  ·  view source on GitHub ↗

* Returns 1 if the path is an "other" path with respect to * the index; that is, the path is not mentioned in the index at all, * either as a file, a directory with some files in the index, * or as an unmerged entry. * * We helpfully remove a trailing "/" from directories so that * the output of read_directory can be used as-is. */

Source from the content-addressed store, hash-verified

3440 * the output of read_directory can be used as-is.
3441 */
3442int index_name_is_other(struct index_state *istate, const char *name,
3443 int namelen)
3444{
3445 int pos;
3446 if (namelen && name[namelen - 1] == '/')
3447 namelen--;
3448 pos = index_name_pos(istate, name, namelen);
3449 if (0 <= pos)
3450 return 0; /* exact match */
3451 pos = -pos - 1;
3452 if (pos < istate->cache_nr) {
3453 struct cache_entry *ce = istate->cache[pos];
3454 if (ce_namelen(ce) == namelen &&
3455 !memcmp(ce->name, name, namelen))
3456 return 0; /* Yup, this one exists unmerged */
3457 }
3458 return 1;
3459}
3460
3461void *read_blob_data_from_index(struct index_state *istate,
3462 const char *path, unsigned long *size)

Callers 5

dir_add_ignoredFunction · 0.85
get_untracked_filesFunction · 0.85
show_other_filesFunction · 0.85
cmd_cleanFunction · 0.85

Calls 1

index_name_posFunction · 0.85

Tested by

no test coverage detected