Re: Expected behavior of "git check-ignore"...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Szakmeister <john@xxxxxxxxxxxxxxx> writes:

> On Mon, Jul 24, 2017 at 3:23 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> [snip]
>> I am reasonably sure that the command started its life as a pure
>> debugging aid.
>>
>> The treatment of the negation _might_ impose conflicting goals to
>> its purpose as a debugging aid---a user who debugs his .gitignore
>> file would want to know what causes a thing that wants to be ignored
>> is not or vice versa, and use of the exit status to indicate if it
>> is ignored may not mesh well with its goal as a debugging aid, but I
>> didn't think about the potential issues deeply myself while writing
>> this response.  As you mentioned, use of (or not using) "-v" could
>> be used as a sign to see which behaviour the end-user expects, I
>> guess.
>
> Is there another way of checking to see if a file is ignored?  If so,...

Maybe I sounded like waffling, but I do think "check-ignore" when
used as an end-user tool should be that command, to get a preview of
what would happen if you gave the path to "git add".  

I was merely giving a possible explanation why it may not behave
like so in the current code, i.e. those who used it for debugging
their .gitignore files may have felt that the current way to handle
negation were more convenient during their debugging session.

But I think there is a way out to satisfy both groups of people.

What if we (re)define that "-v" is a way to ask "which entry, if
any, decides the final fate of this path?" question, and that is a
sign that the user is using it to debug their .gitignore?  And we
use the exit status to mean "Yeah, there is an explicit entry that
decides the fate of the path" in that case, which is what the
current behaviour seems to be---the command exits with non-zero
status only when there is nothing that matches in the exclude
mechanism (which makes the final fate of the path to be 'not
ignored').

And we interpret the lack of "-v" as a signal that the user wants to
learn the fate of a given path via the exit status of the command,
which will "fix" the exit code to match the expectation in your
initial message in this thread.

Would that work well?



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux