Code

Fix off-by-one in read_tree_recursive
[git.git] / diff-no-index.c
index 0a14268ba952da5ff66be753cc0cc147ba64ee2b..7273a7a0b648cc8cbd6dce2043a6e544b87d28b6 100644 (file)
@@ -201,8 +201,6 @@ void diff_no_index(struct rev_info *revs,
                    no_index ? "--no-index" : "[--no-index]");
 
        diff_setup(&revs->diffopt);
-       if (!revs->diffopt.output_format)
-               revs->diffopt.output_format = DIFF_FORMAT_PATCH;
        for (i = 1; i < argc - 2; ) {
                int j;
                if (!strcmp(argv[i], "--no-index"))
@@ -248,6 +246,8 @@ void diff_no_index(struct rev_info *revs,
                revs->diffopt.paths = argv + argc - 2;
        revs->diffopt.nr_paths = 2;
        revs->diffopt.skip_stat_unmatch = 1;
+       if (!revs->diffopt.output_format)
+               revs->diffopt.output_format = DIFF_FORMAT_PATCH;
 
        DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
        DIFF_OPT_SET(&revs->diffopt, NO_INDEX);