From: "Philip Oakley" <philipoakley@iee.org>
To: "Junio C Hamano" <gitster@pobox.com>,
"John Szakmeister" <john@szakmeister.net>
Cc: <git@vger.kernel.org>
Subject: Re: Expected behavior of "git check-ignore"...
Date: Sun, 30 Jul 2017 16:57:26 +0100 [thread overview]
Message-ID: <9C6ADE7816804DDDB398A5D64920FEA0@PhilipOakley> (raw)
In-Reply-To: xmqqd18lolnm.fsf@gitster.mtv.corp.google.com
From: "Junio C Hamano" <gitster@pobox.com>
Sent: Thursday, July 27, 2017 6:05 PM
> John Szakmeister <john@szakmeister.net> writes:
>
>> On Mon, Jul 24, 2017 at 3:23 PM, Junio C Hamano <gitster@pobox.com>
>> 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?
The old answer on StackOverflow
https://stackoverflow.com/questions/12144633/which-gitignore-rule-is-ignoring-my-file
has some of the older gory detail.
I also see that one of the changes was reverted (Revert "Merge branch
'nd/exclusion-regression-fix', 5cee3493, 18 Mar 2016
https://github.com/git/git/commit/5cee349370bd2dce48d0d653ab4ce99bb79a3415#diff-b9ad88b4882e66b5be4541046b713b51).
It doesn't look like any follow up happened to the check-ignore docs.
To me, the return status for the plain vanilla case should always work
correctly. So that is, given one path, using the current index, we know if
it is, or is not, ignored.
The verbose output for debugging should be able to be varied at will (e.g.
re-inclusion can show all operative lines in the debug output). It shouldn't
be a backward compatibility issue.
Maybe that, verbosely, for each path given, the summary status is also given
now that re-inclusion should be possible, which would not have been required
before.
--
Philip
prev parent reply other threads:[~2017-07-30 15:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 10:37 Expected behavior of "git check-ignore" John Szakmeister
2017-07-23 16:33 ` Philip Oakley
2017-07-24 9:33 ` John Szakmeister
2017-07-24 19:23 ` Junio C Hamano
2017-07-27 11:20 ` John Szakmeister
2017-07-27 17:05 ` Junio C Hamano
2017-07-30 15:57 ` Philip Oakley [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9C6ADE7816804DDDB398A5D64920FEA0@PhilipOakley \
--to=philipoakley@iee.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=john@szakmeister.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).