- /* We accept the -u flag as a synonym for "-p" */
- if (!strcmp(arg, "-p") || !strcmp(arg, "-u")) {
- diff_output_format = DIFF_FORMAT_PATCH;
- continue;
- }
- if (!strncmp(arg, "-B", 2)) {
- if ((diff_break_opt = diff_scoreopt_parse(arg)) == -1)
- usage(diff_cache_usage);
- continue;
- }
- if (!strncmp(arg, "-M", 2)) {
- detect_rename = DIFF_DETECT_RENAME;
- if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
- usage(diff_cache_usage);
- continue;
- }
- if (!strncmp(arg, "-C", 2)) {
- detect_rename = DIFF_DETECT_COPY;
- if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
- usage(diff_cache_usage);
- continue;
- }
- if (!strcmp(arg, "--find-copies-harder")) {
- find_copies_harder = 1;
- continue;
- }
- if (!strcmp(arg, "-z")) {
- diff_line_termination = 0;
- continue;
- }
- if (!strcmp(arg, "--name-only")) {
- diff_output_format = DIFF_FORMAT_NAME;
- continue;
- }
- if (!strcmp(arg, "-R")) {
- diff_setup_opt |= DIFF_SETUP_REVERSE;
- continue;
- }
- if (!strncmp(arg, "-S", 2)) {
- pickaxe = arg + 2;
- continue;
- }
- if (!strncmp(arg, "--diff-filter=", 14)) {
- diff_filter = arg + 14;
- continue;
- }
- if (!strncmp(arg, "-O", 2)) {
- orderfile = arg + 2;
- continue;
- }
- if (!strcmp(arg, "--pickaxe-all")) {
- pickaxe_opts = DIFF_PICKAXE_ALL;
+ if (!strcmp(arg, "--cc"))
+ /*
+ * I _think_ "diff-index --cached HEAD" with an
+ * unmerged index could show something else
+ * later, but pretend --cc is the same as -p for
+ * now. "git diff" uses --cc by default.
+ */
+ argv[i] = arg = "-p";
+ diff_opt_cnt = diff_opt_parse(&diff_options, argv + i,
+ argc - i);
+ if (diff_opt_cnt < 0)
+ usage(diff_cache_usage);
+ else if (diff_opt_cnt) {
+ i += diff_opt_cnt - 1;