1958
if (options->abbrev <= 0 || 40 < options->abbrev)
1959
options->abbrev = 40; /* full */
1960
1961
+ /*
1962
+ * It does not make sense to show the first hit we happened
1963
+ * to have found. It does not make sense not to return with
1964
+ * exit code in such a case either.
1965
+ */
1966
+ if (options->quiet) {
1967
+ options->output_format = DIFF_FORMAT_NO_OUTPUT;
1968
+ options->exit_with_status = 1;
1969
+ }
1970
+
1971
+ /*
1972
+ * If we postprocess in diffcore, we cannot simply return
1973
+ * upon the first hit. We need to run diff as usual.
1974
+ */
1975
+ if (options->pickaxe || options->filter)
1976
+ options->quiet = 0;
1977
+
1978
return 0;
1979
}
1980
2153
options->detect_rename = 0;
2154
else if (!strcmp(arg, "--exit-code"))
2155
options->exit_with_status = 1;
2156
+ else if (!strcmp(arg, "--quiet"))
2157
+ options->quiet = 1;
2158
else
2159
return 0;
2160
return 1;
2919
2920
void diffcore_std(struct diff_options *options)
2921
{
2922
+ if (options->quiet)
2923
+ return;
2924
if (options->break_opt != -1)
2925
diffcore_break(options->break_opt);
2926
if (options->detect_rename)
2933
diffcore_order(options->orderfile);
2934
diff_resolve_rename_copy();
2935
diffcore_apply_filter(options->filter);
2915
- if (options->exit_with_status)
2916
- options->has_changes = !!diff_queued_diff.nr;
2936
+
2937
+ options->has_changes = !!diff_queued_diff.nr;
2938
}
2939
2940
2973
fill_filespec(two, sha1, mode);
2974
2975
diff_queue(&diff_queued_diff, one, two);
2976
+ options->has_changes = 1;
2977
}
2978
2979
void diff_change(struct diff_options *options,
2999
fill_filespec(two, new_sha1, new_mode);
3000
3001
diff_queue(&diff_queued_diff, one, two);
3002
+ options->has_changes = 1;
3003
}
3004
3005
void diff_unmerge(struct diff_options *options,