Message ID | 9ea33608-3a6c-c0ef-9bb3-4bb535009aeb@web.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] diff-no-index: release strbuf on queue error | expand |
René Scharfe <l.s.r@web.de> writes: > 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> > --- > Bonus patch "while at it", would have saved me from going "huh?". > Generated using -U8 for easier review. All three patches made sense to me. Thanks. > > diff-no-index.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/diff-no-index.c b/diff-no-index.c > index a18f6c3c63..18edbdf4b5 100644 > --- a/diff-no-index.c > +++ b/diff-no-index.c > @@ -262,17 +262,17 @@ int diff_no_index(struct rev_info *revs, > if (argc != 2) { > if (implicit_no_index) > warning(_("Not a git repository. Use --no-index to " > "compare two paths outside a working tree")); > usage_with_options(diff_no_index_usage, options); > } > 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 > * path that is "-", spell it as "./-". > */ > p = file_from_standard_input; > else if (prefix) > p = to_free[i] = prefix_filename(prefix, p); > -- > 2.37.2
diff --git a/diff-no-index.c b/diff-no-index.c index a18f6c3c63..18edbdf4b5 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -262,17 +262,17 @@ int diff_no_index(struct rev_info *revs, if (argc != 2) { if (implicit_no_index) warning(_("Not a git repository. Use --no-index to " "compare two paths outside a working tree")); usage_with_options(diff_no_index_usage, options); } 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 * path that is "-", spell it as "./-". */ p = file_from_standard_input; else if (prefix) p = to_free[i] = prefix_filename(prefix, p);
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> --- Bonus patch "while at it", would have saved me from going "huh?". Generated using -U8 for easier review. diff-no-index.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.37.2