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

Function add_index_entry

read-cache.c:1301–1326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1299}
1300
1301int add_index_entry(struct index_state *istate, struct cache_entry *ce, int option)
1302{
1303 int pos;
1304
1305 if (option & ADD_CACHE_JUST_APPEND)
1306 pos = istate->cache_nr;
1307 else {
1308 int ret;
1309 ret = add_index_entry_with_check(istate, ce, option);
1310 if (ret <= 0)
1311 return ret;
1312 pos = ret - 1;
1313 }
1314
1315 /* Make sure the array is big enough .. */
1316 ALLOC_GROW(istate->cache, istate->cache_nr + 1, istate->cache_alloc);
1317
1318 /* Add it in.. */
1319 istate->cache_nr++;
1320 if (istate->cache_nr > pos + 1)
1321 MOVE_ARRAY(istate->cache + pos + 1, istate->cache + pos,
1322 istate->cache_nr - pos - 1);
1323 set_index_entry(istate, pos, ce);
1324 istate->cache_changed |= CE_ENTRY_ADDED;
1325 return 0;
1326}
1327
1328/*
1329 * "refresh" does not calculate a new sha1 file or bring the

Callers 15

initialize_attr_indexFunction · 0.85
merge_base_indexFunction · 0.85
do_add_entryFunction · 0.85
fake_working_tree_commitFunction · 0.85
unmerge_index_entryFunction · 0.85
revert_from_diffFunction · 0.85
build_fake_ancestorFunction · 0.85
add_index_fileFunction · 0.85
rename_index_entry_atFunction · 0.85
add_to_indexFunction · 0.85

Calls 2

set_index_entryFunction · 0.70

Tested by

no test coverage detected