| 4935 | } |
| 4936 | |
| 4937 | static void run_diff_cmd(const struct external_diff *pgm, |
| 4938 | const char *name, |
| 4939 | const char *other, |
| 4940 | const char *attr_path, |
| 4941 | struct diff_filespec *one, |
| 4942 | struct diff_filespec *two, |
| 4943 | struct strbuf *msg, |
| 4944 | struct diff_options *o, |
| 4945 | struct diff_filepair *p) |
| 4946 | { |
| 4947 | const char *xfrm_msg = NULL; |
| 4948 | int complete_rewrite = (p->status == DIFF_STATUS_MODIFIED) && p->score; |
| 4949 | int must_show_header = 0; |
| 4950 | struct userdiff_driver *drv = NULL; |
| 4951 | |
| 4952 | if (o->flags.allow_external || !o->ignore_driver_algorithm) |
| 4953 | drv = userdiff_find_by_path(o->repo->index, attr_path); |
| 4954 | |
| 4955 | if (o->flags.allow_external && drv && drv->external.cmd) |
| 4956 | pgm = &drv->external; |
| 4957 | |
| 4958 | if (msg) { |
| 4959 | /* |
| 4960 | * don't use colors when the header is intended for an |
| 4961 | * external diff driver |
| 4962 | */ |
| 4963 | fill_metainfo(msg, name, other, one, two, o, p, |
| 4964 | &must_show_header, |
| 4965 | pgm ? GIT_COLOR_NEVER : o->use_color); |
| 4966 | xfrm_msg = msg->len ? msg->buf : NULL; |
| 4967 | } |
| 4968 | |
| 4969 | if (pgm) { |
| 4970 | run_external_diff(pgm, name, other, one, two, xfrm_msg, o); |
| 4971 | return; |
| 4972 | } |
| 4973 | if (one && two) { |
| 4974 | if (!o->ignore_driver_algorithm && drv && drv->algorithm) |
| 4975 | set_diff_algorithm(o, drv->algorithm); |
| 4976 | |
| 4977 | builtin_diff(name, other ? other : name, |
| 4978 | one, two, xfrm_msg, must_show_header, |
| 4979 | o, complete_rewrite, p->line_ranges); |
| 4980 | if (p->status == DIFF_STATUS_COPIED || |
| 4981 | p->status == DIFF_STATUS_RENAMED) |
| 4982 | o->found_changes = 1; |
| 4983 | } else { |
| 4984 | if (o->file) |
| 4985 | fprintf(o->file, "* Unmerged path %s\n", name); |
| 4986 | o->found_changes = 1; |
| 4987 | } |
| 4988 | } |
| 4989 | |
| 4990 | static void diff_fill_oid_info(struct diff_filespec *one, struct index_state *istate) |
| 4991 | { |
no test coverage detected