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

Function add_cacheinfo

builtin/update-index.c:417–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415}
416
417static int add_cacheinfo(unsigned int mode, const struct object_id *oid,
418 const char *path, int stage)
419{
420 int len, option;
421 struct cache_entry *ce;
422
423 if (!verify_path(path, mode))
424 return error("Invalid path '%s'", path);
425
426 len = strlen(path);
427 ce = make_empty_cache_entry(the_repository->index, len);
428
429 oidcpy(&ce->oid, oid);
430 memcpy(ce->name, path, len);
431 ce->ce_flags = create_ce_flags(stage);
432 ce->ce_namelen = len;
433 ce->ce_mode = create_ce_mode(mode);
434 if (assume_unchanged)
435 ce->ce_flags |= CE_VALID;
436 option = allow_add ? ADD_CACHE_OK_TO_ADD : 0;
437 option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;
438 if (add_index_entry(the_repository->index, ce, option))
439 return error("%s: cannot add to the index - missing --add option?",
440 path);
441 report("add '%s'", path);
442 return 0;
443}
444
445static void chmod_path(char flip, const char *path)
446{

Callers 2

read_index_infoFunction · 0.85
cacheinfo_callbackFunction · 0.85

Calls 8

verify_pathFunction · 0.85
errorFunction · 0.85
make_empty_cache_entryFunction · 0.85
oidcpyFunction · 0.85
create_ce_flagsFunction · 0.85
create_ce_modeFunction · 0.85
add_index_entryFunction · 0.85
reportFunction · 0.70

Tested by

no test coverage detected