| 250 | } |
| 251 | |
| 252 | static void builtin_diff_files(struct rev_info *revs, int argc, const char **argv) |
| 253 | { |
| 254 | unsigned int options = 0; |
| 255 | |
| 256 | while (1 < argc && argv[1][0] == '-') { |
| 257 | if (!strcmp(argv[1], "--base")) |
| 258 | revs->max_count = 1; |
| 259 | else if (!strcmp(argv[1], "--ours")) |
| 260 | revs->max_count = 2; |
| 261 | else if (!strcmp(argv[1], "--theirs")) |
| 262 | revs->max_count = 3; |
| 263 | else if (!strcmp(argv[1], "-q")) |
| 264 | options |= DIFF_SILENT_ON_REMOVED; |
| 265 | else if (!strcmp(argv[1], "-h")) |
| 266 | usage(builtin_diff_usage); |
| 267 | else { |
| 268 | error(_("invalid option: %s"), argv[1]); |
| 269 | usage(builtin_diff_usage); |
| 270 | } |
| 271 | argv++; argc--; |
| 272 | } |
| 273 | |
| 274 | /* |
| 275 | * "diff --base" should not combine merges because it was not |
| 276 | * asked to. "diff -c" should not densify (if the user wants |
| 277 | * dense one, --cc can be explicitly asked for, or just rely |
| 278 | * on the default). |
| 279 | */ |
| 280 | if (revs->max_count == -1 && |
| 281 | (revs->diffopt.output_format & DIFF_FORMAT_PATCH)) |
| 282 | diff_merges_set_dense_combined_if_unset(revs); |
| 283 | |
| 284 | setup_work_tree(the_repository); |
| 285 | if (repo_read_index_preload(the_repository, &revs->diffopt.pathspec, |
| 286 | 0) < 0) { |
| 287 | die_errno("repo_read_index_preload"); |
| 288 | } |
| 289 | run_diff_files(revs, options); |
| 290 | } |
| 291 | |
| 292 | struct symdiff { |
| 293 | struct bitmap *skip; |
no test coverage detected