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

Function read_from_tree

builtin/reset.c:197–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197static 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
225static void set_reflog_message(struct strbuf *sb, const char *action,
226 const char *rev)

Callers 1

cmd_resetFunction · 0.85

Calls 6

copy_pathspecFunction · 0.85
ensure_full_indexFunction · 0.85
do_diff_cacheFunction · 0.85
diffcore_stdFunction · 0.85
diff_flushFunction · 0.85

Tested by

no test coverage detected