| 33 | } |
| 34 | |
| 35 | int cmd_range_diff(int argc, |
| 36 | const char **argv, |
| 37 | const char *prefix, |
| 38 | struct repository *repo UNUSED) |
| 39 | { |
| 40 | struct diff_options diffopt = { NULL }; |
| 41 | struct strvec log_arg = STRVEC_INIT; |
| 42 | struct strvec diff_merges_arg = STRVEC_INIT; |
| 43 | struct range_diff_options range_diff_opts = { |
| 44 | .creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT, |
| 45 | .max_memory = RANGE_DIFF_MAX_MEMORY_DEFAULT, |
| 46 | .diffopt = &diffopt, |
| 47 | .log_arg = &log_arg |
| 48 | }; |
| 49 | int simple_color = -1, left_only = 0, right_only = 0; |
| 50 | struct option range_diff_options[] = { |
| 51 | OPT_INTEGER(0, "creation-factor", |
| 52 | &range_diff_opts.creation_factor, |
| 53 | N_("percentage by which creation is weighted")), |
| 54 | OPT_BOOL(0, "no-dual-color", &simple_color, |
| 55 | N_("use simple diff colors")), |
| 56 | OPT_PASSTHRU_ARGV(0, "notes", &log_arg, |
| 57 | N_("notes"), N_("passed to 'git log'"), |
| 58 | PARSE_OPT_OPTARG), |
| 59 | OPT_PASSTHRU_ARGV(0, "diff-merges", &diff_merges_arg, |
| 60 | N_("style"), N_("passed to 'git log'"), 0), |
| 61 | OPT_CALLBACK(0, "max-memory", &range_diff_opts.max_memory, |
| 62 | N_("size"), |
| 63 | N_("maximum memory for cost matrix (default 4G)"), |
| 64 | parse_max_memory), |
| 65 | OPT_PASSTHRU_ARGV(0, "remerge-diff", &diff_merges_arg, NULL, |
| 66 | N_("passed to 'git log'"), PARSE_OPT_NOARG), |
| 67 | OPT_BOOL(0, "left-only", &left_only, |
| 68 | N_("only emit output related to the first range")), |
| 69 | OPT_BOOL(0, "right-only", &right_only, |
| 70 | N_("only emit output related to the second range")), |
| 71 | OPT_END() |
| 72 | }; |
| 73 | struct option *options; |
| 74 | int i, dash_dash = -1, res = 0; |
| 75 | struct strbuf range1 = STRBUF_INIT, range2 = STRBUF_INIT; |
| 76 | struct object_id oid; |
| 77 | const char *three_dots = NULL; |
| 78 | |
| 79 | repo_config(the_repository, git_diff_ui_config, NULL); |
| 80 | |
| 81 | repo_diff_setup(the_repository, &diffopt); |
| 82 | |
| 83 | options = add_diff_options(range_diff_options, &diffopt); |
| 84 | argc = parse_options(argc, argv, prefix, options, |
| 85 | builtin_range_diff_usage, PARSE_OPT_KEEP_DASHDASH); |
| 86 | |
| 87 | diff_setup_done(&diffopt); |
| 88 | |
| 89 | /* force color when --dual-color was used */ |
| 90 | if (!simple_color) |
| 91 | diffopt.use_color = GIT_COLOR_ALWAYS; |
| 92 |
nothing calls this directly
no test coverage detected