git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: Re: [PATCH 04/10] attr: more matching optimizations from .gitignore
Date: Mon, 8 Oct 2012 10:26:35 +0700	[thread overview]
Message-ID: <CACsJy8DhymVp1ncHvtqd4S7TkBDQvNKBf3A0JTft9bX8_-WX_w@mail.gmail.com> (raw)
In-Reply-To: <7vy5jku549.fsf@alter.siamese.dyndns.org>

On Sat, Oct 6, 2012 at 1:48 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>
>> +Unlike `.gitignore`, negative patterns are not supported.
>> +Patterns that match directories are also not supported.
>
> Is "are not supported" the right phrasing?
>
> I think it makes perfect sense not to forbid "!path attr1", because
> it is unclear what it means (e.g. "path -attr1" vs "path !attr1").
> So I would say "Negative patterns are forbidden as they do not make
> any sense".

!path/sub/ alone does not mean anything. It must be used together with
a positive pattern to define the set of paths the same attribute
assignment statement applies to. This makes sense (attr, -attr1 or
!attr1 are all OK):

*.c attr1
!foo.c attr1

But this does not (actually "!foo.c" line has no effects because of
different attribute assignments):

*.c attr1
!foo.c attr2

It could be even more confusing in multiple attribute manipulation:

*.c attr1
*.h -attr2
!foo.[ch] attr1 -attr2

So "not supported" and "forbidden" are equally OK. I just want to
raise a point that it has some use before we go for "forbidden".

> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
>
>> On Sat, Oct 6, 2012 at 12:36 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>> Or the user might think "path/ attr1" sets attr1 for all files under
>>>> "path/" because it does not make sense to attach attributes to a
>>>> directory in git.
>>>
>>>    ...
>>>
>>>    We may not have a need to assign a real attribute to a directory
>>>    right now, because nothing in Git asks for an attribute for a
>>>    directory. But that does not necessarily mean we would never need a
>>>    way to give an attribute to a directory but not to its contents.
>>
>> Exactly why we should not make "path/ attr" no-op. If we want to make
>> it meaningful some day in future, I don't think we want those no-ops
>> lay around and suddenly cause changes in behavior with a new version
>> of git.
>
> I do not think you understood.  "path/ attr" is a no-op from the
> point of view of the *users* of the current versions of Git.  It is
> perfectly fine to accept and apply attr to "path/"; no codepath in
> Git should be asking about path/ anyway, so it ends up to be a
> no-op.  You shouldn't be erroring out at the syntactic level, i.e.
> when these lines are parsed.

My objection is no-op lines are timed bombs. But users can already do
"dir attr" (no slashes), which is no-op. So yeah, no-op is fine.
-- 
Duy

  parent reply	other threads:[~2012-10-08  3:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05  4:40 [PATCH 00/10] nd/wildmatch take 2 Nguyễn Thái Ngọc Duy
2012-10-05  4:41 ` [PATCH 01/10] gitignore: make pattern parsing code a separate function Nguyễn Thái Ngọc Duy
2012-10-05  4:41 ` [PATCH 02/10] attr: avoid strlen() on every match Nguyễn Thái Ngọc Duy
2012-10-05  4:41 ` [PATCH 03/10] attr: avoid searching for basename " Nguyễn Thái Ngọc Duy
2012-10-05  4:41 ` [PATCH 04/10] attr: more matching optimizations from .gitignore Nguyễn Thái Ngọc Duy
2012-10-05 18:48   ` Junio C Hamano
2012-10-06  5:02     ` Nguyen Thai Ngoc Duy
2012-10-06  5:36       ` Junio C Hamano
2012-10-06  6:43         ` Nguyen Thai Ngoc Duy
2012-10-06  6:59           ` Junio C Hamano
2012-10-08  3:26     ` Nguyen Thai Ngoc Duy [this message]
2012-10-08 15:50       ` Junio C Hamano
2012-10-05  4:41 ` [PATCH 05/10] Import wildmatch from rsync Nguyễn Thái Ngọc Duy
2012-10-05 10:30   ` Peter Krefting
2012-10-05 11:18     ` Nguyen Thai Ngoc Duy
2012-10-05  4:41 ` [PATCH 06/10] wildmatch: remove static variable force_lower_case Nguyễn Thái Ngọc Duy
2012-10-05  4:41 ` [PATCH 07/10] wildmatch: fix case-insensitive matching Nguyễn Thái Ngọc Duy
2012-10-05  4:41 ` [PATCH 08/10] Integrate wildmatch to git Nguyễn Thái Ngọc Duy
2012-10-05 21:20   ` Thiago Farina
2012-10-06  9:25     ` Joachim Schmitz
2012-10-05  4:41 ` [PATCH 09/10] Support "**" in .gitignore and .gitattributes patterns using wildmatch() Nguyễn Thái Ngọc Duy
2012-10-05  4:41 ` [PATCH 10/10] gitignore: forbid "abc**def" Nguyễn Thái Ngọc Duy

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=CACsJy8DhymVp1ncHvtqd4S7TkBDQvNKBf3A0JTft9bX8_-WX_w@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    /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).