On Sun, May 9, 2021 at 10:09 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > "Elijah Newren via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > > > @@ -748,6 +748,9 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) > > if (pathspec.nr && error_unmatch) > > ps_matched = xcalloc(pathspec.nr, 1); > > > > + if ((dir.flags & DIR_SHOW_IGNORED) && !show_others && !show_cached) > > + die("ls-files --ignored is usually used with --others, but --cached is the default. Please specify which you want."); > > + > > So "git ls-files -i" would suddenly start erroring out and users are > to scramble and patch their scripts? Thus the reason I marked this as "RFC" and called it out in the cover letter for folks to comment on. I figured that if I was having difficulty using it correctly and even our own testsuite showed that 50% of such invocations were wrong (despite being reviewed[1]), then it seems likely to me that erroring out to inform folks of this problem might be warranted. But, if folks disagree, I can switch it to a warning instead. [1] https://lore.kernel.org/git/20120724133227.GA14422@xxxxxxxxxxxxxxxxxxxxx/#t > More importantly, the message does not make much sense. "I is > usually used with O" is very true, but the mention of "usually" here > means it is not an error for "I" to be used without "O". That part > is very understandable and correct. > > But I do not know what "but --cached is the default" part wants to > say. If it is the _default_, and (assuming that what I read in the > proposed log message is correct) the combination of "-i -c" is valid, > then I would understand the message if the code were more like this: > > if ((dir.flags & DIR_SHOW_IGNORED) && > !show_others && !show_cached) { > show_cached = 1; /* default */ > warning("ls-files -i given without -o/-c; defaulting to -i -c"); > } > > If we are not defaulting to cached, then > > die("ls-files -i must be used with either -o or -c"); > > would also make sense. Ooh, that wording is much nicer. I'll adopt the latter suggestion, but let me know if you'd rather I went the warning route.