git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: git-check-ignore documentation doesn't come close to describing what it really does
@ 2022-07-12 23:02 Britton Kerin
  2022-07-13  0:17 ` Elijah Newren
  0 siblings, 1 reply; 5+ messages in thread
From: Britton Kerin @ 2022-07-12 23:02 UTC (permalink / raw)
  To: git

It begins:

       For each pathname given via the command-line or from a file via
--stdin, check whether
       the file is excluded by .gitignore (or other input files to the
exclude mechanism) and output
       the path if it is excluded.

In fact it just reports matches from .gitignore etc:

     $ cat .gitignore
     *.o
     !*.dont_ignore
     $ ls
     bar.o.dont_ignore  foo.o
     $ git check-ignore -v -n *
     .gitignore:2:!*.dont_ignore bar.o.dont_ignore
     .gitignore:1:*.o foo.o
     $ # Even more confusing without -v -n:
     $ git check-ignore *
     bar.o.dont_ignore
     foo.o

The EXIT STATUS section is even more wrong:

     EXIT STATUS
            0
                One or more of the provided paths is ignored.

            1
                None of the provided paths are ignored.

            128
                A fatal error was encountered.

but:

     $ if git check-ignore foo.o.dont_ignore; then echo exited true;
else echo exited false; fi
     foo.o.dont_ignore
     exited true
     $

IMO the behavior of git-check-ignore is the correct and useful
behavior and the documentation should simply be fixed to reflect the
fact that it just lists matching entries rather than wrongly claiming
that it returns the overall result of the ignore calculation.

Britton

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-19  6:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-12 23:02 BUG: git-check-ignore documentation doesn't come close to describing what it really does Britton Kerin
2022-07-13  0:17 ` Elijah Newren
2022-07-13 17:06   ` Junio C Hamano
2022-07-18 23:28     ` Britton Leo Kerin
2022-07-19  6:27       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).