| 1299 | } |
| 1300 | |
| 1301 | int 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 |
no test coverage detected