| 842 | } |
| 843 | |
| 844 | struct cache_entry *make_cache_entry(struct index_state *istate, |
| 845 | unsigned int mode, |
| 846 | const struct object_id *oid, |
| 847 | const char *path, |
| 848 | int stage, |
| 849 | unsigned int refresh_options) |
| 850 | { |
| 851 | struct cache_entry *ce, *ret; |
| 852 | int len; |
| 853 | |
| 854 | if (verify_path_internal(path, mode) == PATH_INVALID) { |
| 855 | error(_("invalid path '%s'"), path); |
| 856 | return NULL; |
| 857 | } |
| 858 | |
| 859 | len = strlen(path); |
| 860 | ce = make_empty_cache_entry(istate, len); |
| 861 | |
| 862 | oidcpy(&ce->oid, oid); |
| 863 | memcpy(ce->name, path, len); |
| 864 | ce->ce_flags = create_ce_flags(stage); |
| 865 | ce->ce_namelen = len; |
| 866 | ce->ce_mode = create_ce_mode(mode); |
| 867 | |
| 868 | ret = refresh_cache_entry(istate, ce, refresh_options); |
| 869 | if (ret != ce) |
| 870 | discard_cache_entry(ce); |
| 871 | return ret; |
| 872 | } |
| 873 | |
| 874 | struct cache_entry *make_transient_cache_entry(unsigned int mode, |
| 875 | const struct object_id *oid, |
no test coverage detected