All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] pathspec: reserve some letters after a colon pathspec
Date: Thu, 24 Mar 2011 08:15:39 +0100	[thread overview]
Message-ID: <4D8AEF9B.9050001@drmicha.warpmail.net> (raw)
In-Reply-To: <7vvcz9emrn.fsf@alter.siamese.dyndns.org>

Junio C Hamano venit, vidit, dixit 23.03.2011 19:04:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> 
>> Pathspec ':something' means 'something' at top directory. Limit it a
>> bit so that ':<non-alnum>something' can be reserved for future
>> extensions. ':\<non-alnum>something' can be used to achieve
>> ':something' before this patch.
>>
>> All non-alphanumeric chars on the en_US keyboard, except \ and ., are
>> currently reserved.
> 
> While I was writing the other message, I really was hoping that people
> would notice that trying to limit the magic signature (i.e. "which magic I
> want" in my previous message) to a non-alnum letter that cannot easily be
> remembered would be a bad direction.  A set of short mnemonic is fine, but
> we probably should prepare the syntax framework to reserve spelled out
> magic names for readability.
> 
> Here is a weather-baloon.  I will use colon below as the magic introducer,
> as I don't care very deeply about the choice of it.
> 
>  - "^:([^\w\d]+)(.*)$", that is "a magic introducer followed by a sequence
>    of non-alnum followed by the remainder" means that the part that is
>    given to the matching engine is $2, and each gibberish character in $1
>    determines what magic is requested when the matching engine does its
>    work.  Among the gibberish that can be in $1, we currently would want
>    to support:
> 
>     . '/' denotes that $2 is relative to root of the working tree, i.e. do
>       not add 'prefix' to it at the left.
> 
>     . '!' denotes that the matching with $2 should not honor globbing.
> 
>    e.g.
> 
>     ":/*lib/**/foo.h", if '*' denoted recursive glob support for '**/' to
>     mean "zero-or-more levels of any directory" [*1*], it would find any
>     foo.h in a directory 'lib' or its subdirectory that is found in
>     anywhere in the working tree.
> 
>  - "^:((?:[-a-z]+)(?:,[-a-z+]+)*):(.*)$", that is "a magic introducer,
>    followed by one or more alpha-string separated with comma, followed
>    by a magic terminator, and the remainder" means that the remainder is
>    what is given to the matching engine, and the alpha-strings spell out
>    the name of the magic.  We currently would want to support:
> 
>     . 'full-tree' means exactly the same as '/' mnemonic above.
>     . 'noglob' means exactly the same as '!' mnemonic.
> 
>    e.g.
> 
>    ":full-tree,recursive-glob:lib/**/foo.h" would be how you fully spell
>    the above example in the mnemonic section [*2*].

I like this a lot, especially the fact that we would have descriptive
long names as well as short versions for a subset! Two remarks:

:(symlink|submodule|directory|file): would fit into that scheme (for use
in .gitattributes), though I'm not sure we want that for general
pathspecs. We probably want textconv applied to :file: only by default,
attributes to match with :file only?

We already have ":./cdwfile" as in "commit:./cwdfile", and this looks
like a preexisting instance, although it is not ("commit:" gets stripped
and "./cwdfile" is the pathspec). People will probably try something
like "commit:/rootfile", and we may or may not want to support this.
That particular one is easy, but "commit:full-tree:name" has a defined
meaning now...

Michael

  reply	other threads:[~2011-03-24  7:19 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28  0:17 git-grep to operate across who repository and not just CWD? David Chanters
2011-02-28  9:27 ` Michael J Gruber
2011-02-28 15:27   ` Jay Soffian
2011-02-28 18:32     ` Junio C Hamano
2011-02-28 18:38       ` Junio C Hamano
2011-02-28 22:25   ` Phil Hord
2011-03-01  8:05     ` Michael J Gruber
2011-03-01  8:16       ` Nguyen Thai Ngoc Duy
2011-03-01  8:54         ` Michael J Gruber
2011-03-01  9:32           ` Nguyen Thai Ngoc Duy
2011-03-01  9:44             ` Nguyen Thai Ngoc Duy
2011-03-01  9:53               ` [PATCH/POC 0/2] grep --full-tree Michael J Gruber
2011-03-01  9:53                 ` [PATCH/RFC 1/2] grep: --full-tree Michael J Gruber
2011-03-01  9:53                 ` [PATCH/RFC 2/2] grep: make --full-tree work with pathspecs Michael J Gruber
2011-03-01 19:20                   ` Junio C Hamano
2011-03-01 10:21               ` [PATCH/alternative/raw and rough] setup.c: denote repo wide pathspecs by ':' Michael J Gruber
2011-03-01 11:13                 ` Nguyen Thai Ngoc Duy
2011-03-01 11:16                   ` Michael J Gruber
2011-03-01 11:50                     ` Nguyen Thai Ngoc Duy
2011-03-01 11:57                       ` Michael J Gruber
2011-03-01 12:08                         ` Nguyen Thai Ngoc Duy
2011-03-01 14:50                           ` Junio C Hamano
2011-03-01 15:01                             ` Michael J Gruber
2011-03-01 20:00                               ` Junio C Hamano
2011-03-02 12:34                               ` Sverre Rabbelier
2011-03-02 12:57                                 ` Nguyen Thai Ngoc Duy
2011-03-02 13:12                                   ` Michael J Gruber
2011-03-02 16:53                                     ` Junio C Hamano
2011-03-02 17:31                                       ` Michael J Gruber
2011-03-03  2:42                                         ` Miles Bader
2011-03-03  3:52                                           ` Junio C Hamano
2011-03-03  3:44                                       ` Phil Hord
2011-03-03  8:20                                         ` Michael J Gruber
2011-03-01 16:25                             ` Phil Hord
2011-03-01 18:31                             ` James Pickens
2011-03-02  0:12                     ` Nguyen Thai Ngoc Duy
2011-03-03  3:51                       ` Phil Hord
2011-03-03  8:21                         ` Michael J Gruber
2011-03-01 11:49                 ` Michael J Gruber
2011-03-01 13:05                   ` Phil Hord
2011-03-23 15:32                 ` [PATCH] pathspec: reserve some letters after a colon pathspec Nguyễn Thái Ngọc Duy
2011-03-23 18:04                   ` Junio C Hamano
2011-03-24  7:15                     ` Michael J Gruber [this message]
2011-03-24  7:49                       ` Nguyen Thai Ngoc Duy
2011-03-24  8:12                         ` Junio C Hamano
2011-03-24 14:46                       ` Junio C Hamano

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D8AEF9B.9050001@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.