git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] check-ignore: fix handling with negated patterns
Date: Mon, 17 Feb 2020 13:07:46 -0800	[thread overview]
Message-ID: <CABPp-BHaTK62W4_rUaJXNUPSfu9cBD5MrmjgbJeMuA+7s3+rGg@mail.gmail.com> (raw)
In-Reply-To: <xmqqeeutkkur.fsf@gitster-ct.c.googlers.com>

On Mon, Feb 17, 2020 at 12:41 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Elijah Newren <newren@gmail.com> writes:
>
> >> I suspect that the above distorts history.  IIRC, it was meant as a
> >> tool to see which exact pattern in the exclude sequence had the
> >> final say for the given needle, written primarily as a debugging
> >> aid.  In that context, "This rule has the final say", whether the
> >> rule is a negative or positive, still means something.
> >
> > I can reword it; how does the following sound?
> >
> > check-ignore claims that it reports whether each path it is given is
> > excluded.  However, it fails to do so because it did not account for
> > negated patterns.
>
> I am not sure about "claims" part.
>
> Isn't it more like "check-ignore has been the tool that reports the
> rule that has final say on each of the paths it is given, but that
> is not very useful when the user wants to see if the path is
> excluded (e.g. the rule with the final say may be negative).

No, it is not more like that; the check-ignore manpage currently claims this:

       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.

Note also that this description at the beginning of the manpage says
nothing about reporting which rule has the final say.  And, in fact,
the command in default mode does not report which rule or rules were
involved.  All of that work falls to the --verbose flag, which was
documented as

           Also output details about the matching pattern (if any) for
each given pathname. For precedence rules within and between
           exclude sources, see gitignore(5).

Now, if you read both descriptions together, you find that these
claims are contradictory and that it cannot do both, so the "Also" bit
it leads with is a lie.  As such, my commit modified the definition of
verbose to make it instead read:

       Instead of printing the paths that are excluded, for each path
       that matches an exclude pattern print the exclude pattern
       together with the path.  (Matching an exclude pattern usually
       means the path is excluded, but if the pattern begins with '!'
       then it is a negated pattern and matching it means the path is
       NOT excluded.)

This was a change of description for the --verbose flag, not a change
of implementation.  Thus, in my opinion, no transition period is
needed: those who wanted to use check-ignore to see what rule would
have matched had to use --verbose before, and --verbose behaves the
same as before.

Those who wanted to use check-ignore without the --verbose flag to see
if a rule is excluded, get corrected behavior that will actually do
that.

  reply	other threads:[~2020-02-17 21:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17 16:15 [PATCH] check-ignore: fix handling with negated patterns Elijah Newren via GitGitGadget
2020-02-17 18:04 ` Junio C Hamano
2020-02-17 18:41   ` Elijah Newren
2020-02-17 20:41     ` Junio C Hamano
2020-02-17 21:07       ` Elijah Newren [this message]
2020-02-19 21:36         ` Junio C Hamano
2020-02-18 20:36 ` [PATCH v2] check-ignore: fix documentation and implementation to match Elijah Newren via GitGitGadget
2020-02-18 21:27   ` Junio C Hamano
2020-02-18 23:05   ` [PATCH v3] " Elijah Newren via GitGitGadget

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=CABPp-BHaTK62W4_rUaJXNUPSfu9cBD5MrmjgbJeMuA+7s3+rGg@mail.gmail.com \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    /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).