From d7de00f7e0d2374cb7933d2ee1ebe5273a8acf53 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 Jun 2006 20:26:49 +0300 Subject: [PATCH 1/2] --name-only, --name-status, --check and -s are mutually exclusive Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- diff.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/diff.c b/diff.c index 1c131ff4dc..5358fd0c14 100644 --- a/diff.c +++ b/diff.c @@ -1433,6 +1433,19 @@ void diff_setup(struct diff_options *options) int diff_setup_done(struct diff_options *options) { + int count = 0; + + if (options->output_format & DIFF_FORMAT_NAME) + count++; + if (options->output_format & DIFF_FORMAT_NAME_STATUS) + count++; + if (options->output_format & DIFF_FORMAT_CHECKDIFF) + count++; + if (options->output_format & DIFF_FORMAT_NO_OUTPUT) + count++; + if (count > 1) + die("--name-only, --name-status, --check and -s are mutually exclusive"); + if ((options->find_copies_harder && options->detect_rename != DIFF_DETECT_COPY) || (0 <= options->rename_limit && !options->detect_rename)) From 5faf64cd28bf79f0c2939717d2ba117498717059 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 Jun 2006 20:28:42 +0300 Subject: [PATCH 2/2] Remove awkward compatibility warts Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-diff-files.c | 7 ------- builtin-diff.c | 7 ------- 2 files changed, 14 deletions(-) diff --git a/builtin-diff-files.c b/builtin-diff-files.c index a655eea91e..3361898ada 100644 --- a/builtin-diff-files.c +++ b/builtin-diff-files.c @@ -47,12 +47,5 @@ int cmd_diff_files(int argc, const char **argv, char **envp) if (rev.pending.nr || rev.min_age != -1 || rev.max_age != -1) usage(diff_files_usage); - /* - * Backward compatibility wart - "diff-files -s" used to - * defeat the common diff option "-s" which asked for - * DIFF_FORMAT_NO_OUTPUT. - */ - if (rev.diffopt.output_format == DIFF_FORMAT_NO_OUTPUT) - rev.diffopt.output_format = DIFF_FORMAT_RAW; return run_diff_files(&rev, silent); } diff --git a/builtin-diff.c b/builtin-diff.c index d520c7ca29..059eb6de49 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -56,13 +56,6 @@ static int builtin_diff_files(struct rev_info *revs, if (revs->max_count < 0 && (revs->diffopt.output_format & DIFF_FORMAT_PATCH)) revs->combine_merges = revs->dense_combined_merges = 1; - /* - * Backward compatibility wart - "diff-files -s" used to - * defeat the common diff option "-s" which asked for - * DIFF_FORMAT_NO_OUTPUT. - */ - if (revs->diffopt.output_format == DIFF_FORMAT_NO_OUTPUT) - revs->diffopt.output_format = DIFF_FORMAT_RAW; return run_diff_files(revs, silent); }