| 28 | } |
| 29 | |
| 30 | int cmd_diff_pairs(int argc, const char **argv, const char *prefix, |
| 31 | struct repository *repo) |
| 32 | { |
| 33 | struct strbuf path_dst = STRBUF_INIT; |
| 34 | struct strbuf path = STRBUF_INIT; |
| 35 | struct strbuf meta = STRBUF_INIT; |
| 36 | struct option *parseopts; |
| 37 | struct rev_info revs; |
| 38 | int line_term = '\0'; |
| 39 | int ret; |
| 40 | |
| 41 | const char * const builtin_diff_pairs_usage[] = { |
| 42 | N_("git diff-pairs -z [<diff-options>]"), |
| 43 | NULL |
| 44 | }; |
| 45 | struct option builtin_diff_pairs_options[] = { |
| 46 | OPT_END() |
| 47 | }; |
| 48 | |
| 49 | repo_init_revisions(repo, &revs, prefix); |
| 50 | |
| 51 | /* |
| 52 | * Diff options are usually parsed implicitly as part of |
| 53 | * setup_revisions(). Explicitly handle parsing to ensure options are |
| 54 | * printed in the usage message. |
| 55 | */ |
| 56 | parseopts = add_diff_options(builtin_diff_pairs_options, &revs.diffopt); |
| 57 | show_usage_with_options_if_asked(argc, argv, builtin_diff_pairs_usage, parseopts); |
| 58 | |
| 59 | repo_config(repo, git_diff_basic_config, NULL); |
| 60 | revs.diffopt.no_free = 1; |
| 61 | revs.disable_stdin = 1; |
| 62 | revs.abbrev = 0; |
| 63 | revs.diff = 1; |
| 64 | |
| 65 | argc = parse_options(argc, argv, prefix, parseopts, builtin_diff_pairs_usage, |
| 66 | PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_DASHDASH); |
| 67 | |
| 68 | if (setup_revisions(argc, argv, &revs, NULL) > 1) |
| 69 | usagef(_("unrecognized argument: %s"), argv[0]); |
| 70 | |
| 71 | /* |
| 72 | * With the -z option, both command input and raw output are |
| 73 | * NUL-delimited (this mode does not affect patch output). At present |
| 74 | * only NUL-delimited raw diff formatted input is supported. |
| 75 | */ |
| 76 | if (revs.diffopt.line_termination) |
| 77 | usage(_("working without -z is not supported")); |
| 78 | |
| 79 | if (revs.prune_data.nr) |
| 80 | usage(_("pathspec arguments not supported")); |
| 81 | |
| 82 | if (revs.pending.nr || revs.max_count != -1 || |
| 83 | revs.min_age != (timestamp_t)-1 || |
| 84 | revs.max_age != (timestamp_t)-1) |
| 85 | usage(_("revision arguments not allowed")); |
| 86 | |
| 87 | if (!revs.diffopt.output_format) |
nothing calls this directly
no test coverage detected