X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diff-cache.c;h=1d355aa028f2521e8da5b77d14f35bd26eaaa3e4;hb=8544a6f1b8e7340924c406d717ac37becd2f6046;hp=2aaf16a39dafbf0e03893f61ebbf54f9dae06ae7;hpb=af5323e0274fad058f13949b89a9191a7bef7e38;p=git.git diff --git a/diff-cache.c b/diff-cache.c index 2aaf16a3..1d355aa0 100644 --- a/diff-cache.c +++ b/diff-cache.c @@ -157,7 +157,7 @@ static void mark_merge_entries(void) } static char *diff_cache_usage = -"git-diff-cache [-p] [-r] [-z] [-m] [-M] [-C] [-R] [-S] [--cached] [...]"; +"git-diff-cache [-p] [-r] [-z] [-m] [-M] [-C] [-R] [-S] [-O] [--cached] [...]"; int main(int argc, const char **argv) { @@ -167,13 +167,14 @@ int main(int argc, const char **argv) void *tree; unsigned long size; int ret; + int allow_options = 1; int i; read_cache(); for (i = 1; i < argc; i++) { const char *arg = argv[i]; - if (*arg != '-') { + if (!allow_options || *arg != '-') { if (tree_name) { pathspec = argv + i; break; @@ -182,6 +183,10 @@ int main(int argc, const char **argv) continue; } + if (!strcmp(arg, "--")) { + allow_options = 0; + continue; + } if (!strcmp(arg, "-r")) { /* We accept the -r flag just to look like git-diff-tree */ continue; @@ -191,17 +196,20 @@ int main(int argc, const char **argv) continue; } if (!strncmp(arg, "-B", 2)) { - diff_break_opt = diff_scoreopt_parse(arg); + if ((diff_break_opt = diff_scoreopt_parse(arg)) == -1) + usage(diff_cache_usage); continue; } if (!strncmp(arg, "-M", 2)) { detect_rename = DIFF_DETECT_RENAME; - diff_score_opt = diff_scoreopt_parse(arg); + if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1) + usage(diff_cache_usage); continue; } if (!strncmp(arg, "-C", 2)) { detect_rename = DIFF_DETECT_COPY; - diff_score_opt = diff_scoreopt_parse(arg); + if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1) + usage(diff_cache_usage); continue; } if (!strcmp(arg, "-z")) {