Re: [PATCH] pathspec: reserve some letters after a colon pathspec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> 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*].


[Footnote]

*1* "man zshexpn" and look for "Recursive Globbing".

*2* It would be "/full-tree,recursive-glob/lib/**/foo.h" if the magic
introducer were '/', which might be easier to the eye.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]