struct stat *st, unsigned ce_option,
unsigned *dirty_submodule)
{
- int changed = ce_match_stat(ce, st, ce_option);
+ int changed = ie_match_stat(diffopt->repo->index, ce, st, ce_option);
if (S_ISGITLINK(ce->ce_mode)) {
struct diff_flags orig_flags = diffopt->flags;
if (!diffopt->flags.override_submodule_config)
unsigned ce_option = ((option & DIFF_RACY_IS_MODIFIED)
? CE_MATCH_RACY_IS_DIRTY : 0);
uint64_t start = getnanotime();
+ struct index_state *istate = revs->diffopt.repo->index;
diff_set_mnemonic_prefix(&revs->diffopt, "i/", "w/");
if (diff_unmerged_stage < 0)
diff_unmerged_stage = 2;
- entries = active_nr;
+ entries = istate->cache_nr;
for (i = 0; i < entries; i++) {
unsigned int oldmode, newmode;
- struct cache_entry *ce = active_cache[i];
+ struct cache_entry *ce = istate->cache[i];
int changed;
unsigned dirty_submodule = 0;
const struct object_id *old_oid, *new_oid;
if (diff_can_quit_early(&revs->diffopt))
break;
- if (!ce_path_match(&the_index, ce, &revs->prune_data, NULL))
+ if (!ce_path_match(istate, ce, &revs->prune_data, NULL))
continue;
if (ce_stage(ce)) {
dpath->mode = wt_mode;
while (i < entries) {
- struct cache_entry *nce = active_cache[i];
+ struct cache_entry *nce = istate->cache[i];
int stage;
if (strcmp(ce->name, nce->name))
}
if (revs->combine_merges && !cached &&
- (oidcmp(oid, &old_entry->oid) || oidcmp(&old_entry->oid, &new_entry->oid))) {
+ (!oideq(oid, &old_entry->oid) || !oideq(&old_entry->oid, &new_entry->oid))) {
struct combine_diff_path *p;
int pathlen = ce_namelen(new_entry);
}
oldmode = old_entry->ce_mode;
- if (mode == oldmode && !oidcmp(oid, &old_entry->oid) && !dirty_submodule &&
+ if (mode == oldmode && oideq(oid, &old_entry->oid) && !dirty_submodule &&
!revs->diffopt.flags.find_copies_harder)
return 0;
if (tree == o->df_conflict_entry)
tree = NULL;
- if (ce_path_match(&the_index, idx ? idx : tree, &revs->prune_data, NULL)) {
+ if (ce_path_match(revs->diffopt.repo->index,
+ idx ? idx : tree,
+ &revs->prune_data, NULL)) {
do_oneway_diff(o, idx, tree);
if (diff_can_quit_early(&revs->diffopt)) {
o->exiting_early = 1;
opts.merge = 1;
opts.fn = oneway_diff;
opts.unpack_data = revs;
- opts.src_index = &the_index;
+ opts.src_index = revs->diffopt.repo->index;
opts.dst_index = NULL;
opts.pathspec = &revs->diffopt.pathspec;
opts.pathspec->recursive = 1;
int run_diff_index(struct rev_info *revs, int cached)
{
struct object_array_entry *ent;
- uint64_t start = getnanotime();
if (revs->pending.nr != 1)
BUG("run_diff_index must be passed exactly one tree");
+ trace_performance_enter();
ent = revs->pending.objects;
if (diff_cache(revs, &ent->item->oid, ent->name, cached))
exit(128);
diff_set_mnemonic_prefix(&revs->diffopt, "c/", cached ? "i/" : "w/");
- diffcore_fix_diff_index(&revs->diffopt);
+ diffcore_fix_diff_index();
diffcore_std(&revs->diffopt);
diff_flush(&revs->diffopt);
- trace_performance_since(start, "diff-index");
+ trace_performance_leave("diff-index");
return 0;
}
{
struct rev_info revs;
- init_revisions(&revs, NULL);
+ repo_init_revisions(opt->repo, &revs, NULL);
copy_pathspec(&revs.prune_data, &opt->pathspec);
revs.diffopt = *opt;
return 0;
}
-int index_differs_from(const char *def, const struct diff_flags *flags,
+int index_differs_from(struct repository *r,
+ const char *def, const struct diff_flags *flags,
int ita_invisible_in_index)
{
struct rev_info rev;
struct setup_revision_opt opt;
- init_revisions(&rev, NULL);
+ repo_init_revisions(r, &rev, NULL);
memset(&opt, 0, sizeof(opt));
opt.def = def;
setup_revisions(0, NULL, &rev, &opt);