| 415 | } |
| 416 | |
| 417 | static 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 | |
| 445 | static void chmod_path(char flip, const char *path) |
| 446 | { |
no test coverage detected