4460
const char *xfrm_msg = NULL;
4461
int complete_rewrite = (p->status == DIFF_STATUS_MODIFIED) && p->score;
4462
int must_show_header = 0;
4463
+ struct userdiff_driver *drv = NULL;
4464
4464
-
4465
- if (o->flags.allow_external) {
4466
- struct userdiff_driver *drv;
4467
-
4465
+ if (o->flags.allow_external || !o->ignore_driver_algorithm)
4466
drv = userdiff_find_by_path(o->repo->index, attr_path);
4469
- if (drv && drv->external)
4470
- pgm = drv->external;
4471
- }
4467
+
4468
+ if (o->flags.allow_external && drv && drv->external)
4469
+ pgm = drv->external;
4470
4471
if (msg) {
4472
/*
4483
run_external_diff(pgm, name, other, one, two, xfrm_msg, o);
4484
return;
4485
}
4488
- if (one && two)
4486
+ if (one && two) {
4487
+ if (!o->ignore_driver_algorithm && drv && drv->algorithm)
4488
+ set_diff_algorithm(o, drv->algorithm);
4489
+
4490
builtin_diff(name, other ? other : name,
4491
one, two, xfrm_msg, must_show_header,
4492
o, complete_rewrite);
4492
- else
4493
+ } else {
4494
fprintf(o->file, "* Unmerged path %s\n", name);
4495
+ }
4496
}
4497
4498
static void diff_fill_oid_info(struct diff_filespec *one, struct index_state *istate)
4589
const char *name;
4590
const char *other;
4591
4592
+ if (!o->ignore_driver_algorithm) {
4593
+ struct userdiff_driver *drv = userdiff_find_by_path(o->repo->index,
4594
+ p->one->path);
4595
+
4596
+ if (drv && drv->algorithm)
4597
+ set_diff_algorithm(o, drv->algorithm);
4598
+ }
4599
+
4600
if (DIFF_PAIR_UNMERGED(p)) {
4601
/* unmerged */
4602
builtin_diffstat(p->one->path, NULL, NULL, NULL,
5150
return error(_("option diff-algorithm accepts \"myers\", "
5151
"\"minimal\", \"patience\" and \"histogram\""));
5152
5153
+ options->ignore_driver_algorithm = 1;
5154
+
5155
return 0;
5156
}
5157
5167
BUG("available diff algorithms include \"myers\", "
5168
"\"minimal\", \"patience\" and \"histogram\"");
5169
5170
+ options->ignore_driver_algorithm = 1;
5171
+
5172
return 0;
5173
}
5174
5309
for (i = 0; i < options->anchors_nr; i++)
5310
free(options->anchors[i]);
5311
options->anchors_nr = 0;
5312
+ options->ignore_driver_algorithm = 1;
5313
5314
return set_diff_algorithm(options, "patience");
5315
}