git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philip Oakley <philipoakley@iee.email>
To: Junio C Hamano <gitster@pobox.com>, Chris Torek <chris.torek@gmail.com>
Cc: Derrick Stolee <stolee@gmail.com>, Johannes Sixt <j6t@kdbg.org>,
	Danial Alihosseini <danial.alihosseini@gmail.com>,
	Jeff King <peff@peff.net>, Derrick Stolee <dstolee@microsoft.com>,
	Git List <git@vger.kernel.org>
Subject: Re: git 2.34.0: Behavior of `**` in gitignore is different from previous versions.
Date: Tue, 23 Nov 2021 12:21:00 +0000	[thread overview]
Message-ID: <09cbc27d-8fdf-ed84-716f-23fd8dbb11de@iee.email> (raw)
In-Reply-To: <xmqq5ysmnxnx.fsf@gitster.g>

On 21/11/2021 00:46, Junio C Hamano wrote:
> Chris Torek <chris.torek@gmail.com> writes:
>
>> ...  So the standard
>> explanation -- at least, the one I use -- is this:
>>
>>  * Git opens and reads the working tree directory.  For each file
>>    or directory that is actually present here, Git checks it
>>    against the ignore rules.  Some rules match only directories
>>    and others match both directories and files.  Some rules say
>>    "do ignore" and some say "do not ignore".
>>
>>  * The *last* applicable rule wins.
>>
>>  * If this is a file and the file is ignored, it's ignored.
>>    Unless, that is, it's in the index already, because then it's
>>    tracked and can't be ignored.
>>
>>  * If this is a directory and the directory is ignored, it's
>>    not even opened and read.  It's not in the index because
>>    directories are never in the index (at least nominally).
>>    If it is opened and read, the entire set of rules here
>>    apply recursively.
>>
>> This works, but skips over files that are in the index and are in
>> a directory that won't be read.  So I add one last rule, which is
> All of the above is sensible.  If you deal with a path that is in
> the index upfront, you can simplify the later rules somewhat, I
> would think.  I.e. add a first rule before everything else that
> says:
>
>  * A file in the index is not ignored.  Everything below is about a
>    path not in the index.
>
> Then your third rule can lose "Unless...", and you do not have to
> add one last rule outside the bulleted list, either.
>
> ;-)
>
Perhaps, the clarifications are an opportunity to improve the
documentation, should the Danial think that the explanation would have
helped. The 'ignore' matching rules does appear to show up quite often
on the list.

Any thoughts, Danial?

Philip

  reply	other threads:[~2021-11-23 12:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 16:41 git 2.34.0: Behavior of `**` in gitignore is different from previous versions Danial Alihosseini
2021-11-18 17:04 ` Jeff King
2021-11-18 22:09   ` Derrick Stolee
2021-11-19  4:01     ` Danial Alihosseini
2021-11-19 14:51       ` Derrick Stolee
2021-11-19 17:06         ` Danial Alihosseini
2021-11-19 20:05         ` Johannes Sixt
2021-11-19 20:33           ` Derrick Stolee
2021-11-19 20:57             ` Ævar Arnfjörð Bjarmason
2021-11-20 22:41             ` Chris Torek
2021-11-21  0:46               ` Junio C Hamano
2021-11-23 12:21                 ` Philip Oakley [this message]
2021-11-23 21:13                   ` Danial Alihosseini

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=09cbc27d-8fdf-ed84-716f-23fd8dbb11de@iee.email \
    --to=philipoakley@iee.email \
    --cc=chris.torek@gmail.com \
    --cc=danial.alihosseini@gmail.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=peff@peff.net \
    --cc=stolee@gmail.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).