]> git.ipfire.org Git - thirdparty/git.git/commitdiff
diff-no-index: simplify argv index calculation
authorRené Scharfe <l.s.r@web.de>
Wed, 7 Sep 2022 11:45:42 +0000 (13:45 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Sep 2022 19:36:43 +0000 (12:36 -0700)
Since 16bb3d714d (diff --no-index: use parse_options() instead of
diff_opt_parse(), 2019-03-24) argc must be 2 if we reach the loop, i.e.
argc - 2 == 0.  Remove that inconsequential term.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-no-index.c

index a18f6c3c6306b74f3197a1049b9f5973733c942f..18edbdf4b59ec020cc58e3d16d01d92edfdc302e 100644 (file)
@@ -267,7 +267,7 @@ int diff_no_index(struct rev_info *revs,
        }
        FREE_AND_NULL(options);
        for (i = 0; i < 2; i++) {
-               const char *p = argv[argc - 2 + i];
+               const char *p = argv[i];
                if (!strcmp(p, "-"))
                        /*
                         * stdin should be spelled as "-"; if you have