diff options
Diffstat (limited to 'diff-no-index.c')
-rw-r--r-- | diff-no-index.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/diff-no-index.c b/diff-no-index.c index b60d3455da..60ed17470a 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -173,8 +173,10 @@ void diff_no_index(struct rev_info *revs, /* Were we asked to do --no-index explicitly? */ for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "--")) - return; + if (!strcmp(argv[i], "--")) { + i++; + break; + } if (!strcmp(argv[i], "--no-index")) no_index = 1; if (argv[i][0] != '-') @@ -198,13 +200,6 @@ void diff_no_index(struct rev_info *revs, die("git diff %s takes two paths", no_index ? "--no-index" : "[--no-index]"); - /* - * If the user asked for our exit code then don't start a - * pager or we would end up reporting its exit code instead. - */ - if (!DIFF_OPT_TST(&revs->diffopt, EXIT_WITH_STATUS)) - setup_pager(); - diff_setup(&revs->diffopt); if (!revs->diffopt.output_format) revs->diffopt.output_format = DIFF_FORMAT_PATCH; @@ -212,8 +207,12 @@ void diff_no_index(struct rev_info *revs, int j; if (!strcmp(argv[i], "--no-index")) i++; - else if (!strcmp(argv[1], "-q")) + else if (!strcmp(argv[i], "-q")) { options |= DIFF_SILENT_ON_REMOVED; + i++; + } + else if (!strcmp(argv[i], "--")) + i++; else { j = diff_opt_parse(&revs->diffopt, argv + i, argc - i); if (!j) @@ -222,6 +221,13 @@ void diff_no_index(struct rev_info *revs, } } + /* + * If the user asked for our exit code then don't start a + * pager or we would end up reporting its exit code instead. + */ + if (!DIFF_OPT_TST(&revs->diffopt, EXIT_WITH_STATUS)) + setup_pager(); + if (prefix) { int len = strlen(prefix); |