| 195 | } |
| 196 | |
| 197 | static int read_from_tree(const struct pathspec *pathspec, |
| 198 | struct object_id *tree_oid, |
| 199 | int intent_to_add) |
| 200 | { |
| 201 | struct diff_options opt; |
| 202 | |
| 203 | memset(&opt, 0, sizeof(opt)); |
| 204 | copy_pathspec(&opt.pathspec, pathspec); |
| 205 | opt.output_format = DIFF_FORMAT_CALLBACK; |
| 206 | opt.format_callback = update_index_from_diff; |
| 207 | opt.format_callback_data = &intent_to_add; |
| 208 | opt.flags.override_submodule_config = 1; |
| 209 | opt.flags.recursive = 1; |
| 210 | opt.repo = the_repository; |
| 211 | opt.change = diff_change; |
| 212 | opt.add_remove = diff_addremove; |
| 213 | |
| 214 | if (pathspec->nr && pathspec_needs_expanded_index(the_repository->index, pathspec)) |
| 215 | ensure_full_index(the_repository->index); |
| 216 | |
| 217 | if (do_diff_cache(tree_oid, &opt)) |
| 218 | return 1; |
| 219 | diffcore_std(&opt); |
| 220 | diff_flush(&opt); |
| 221 | |
| 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | static void set_reflog_message(struct strbuf *sb, const char *action, |
| 226 | const char *rev) |
no test coverage detected