| 110 | } |
| 111 | |
| 112 | int cmd_diff_tree(int argc, |
| 113 | const char **argv, |
| 114 | const char *prefix, |
| 115 | struct repository *repo UNUSED) |
| 116 | { |
| 117 | char line[1000]; |
| 118 | struct object *tree1, *tree2; |
| 119 | static struct rev_info *opt = &log_tree_opt; |
| 120 | struct setup_revision_opt s_r_opt; |
| 121 | struct userformat_want w; |
| 122 | int read_stdin = 0; |
| 123 | int merge_base = 0; |
| 124 | |
| 125 | show_usage_if_asked(argc, argv, diff_tree_usage); |
| 126 | |
| 127 | repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */ |
| 128 | |
| 129 | prepare_repo_settings(the_repository); |
| 130 | the_repository->settings.command_requires_full_index = 0; |
| 131 | |
| 132 | repo_init_revisions(the_repository, opt, prefix); |
| 133 | if (repo_read_index(the_repository) < 0) |
| 134 | die(_("index file corrupt")); |
| 135 | opt->abbrev = 0; |
| 136 | opt->diff = 1; |
| 137 | opt->disable_stdin = 1; |
| 138 | memset(&s_r_opt, 0, sizeof(s_r_opt)); |
| 139 | s_r_opt.tweak = diff_tree_tweak_rev; |
| 140 | |
| 141 | prefix = precompose_argv_prefix(argc, argv, prefix); |
| 142 | argc = setup_revisions(argc, argv, opt, &s_r_opt); |
| 143 | |
| 144 | memset(&w, 0, sizeof(w)); |
| 145 | userformat_find_requirements(NULL, &w); |
| 146 | |
| 147 | if (!opt->show_notes_given && w.notes) |
| 148 | opt->show_notes = 1; |
| 149 | if (opt->show_notes) |
| 150 | load_display_notes(&opt->notes_opt); |
| 151 | |
| 152 | while (--argc > 0) { |
| 153 | const char *arg = *++argv; |
| 154 | |
| 155 | if (!strcmp(arg, "--stdin")) { |
| 156 | read_stdin = 1; |
| 157 | continue; |
| 158 | } |
| 159 | if (!strcmp(arg, "--merge-base")) { |
| 160 | merge_base = 1; |
| 161 | continue; |
| 162 | } |
| 163 | usage(diff_tree_usage); |
| 164 | } |
| 165 | |
| 166 | if (read_stdin && merge_base) |
| 167 | die(_("options '%s' and '%s' cannot be used together"), "--stdin", "--merge-base"); |
| 168 | if (merge_base && opt->pending.nr != 2) |
| 169 | die(_("--merge-base only works with two commits")); |
nothing calls this directly
no test coverage detected