Re: [PATCH 1/4] magic pathspec: add tentative ":/path/from/top/level" pathspec support

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Nguyen Thai Ngoc Duy <pclouds@xxxxxxxxx> writes:
>
>> On Thu, Apr 7, 2011 at 11:18 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>>
>>> This is so that you can say ":/.gitignore" and do not have to say
>>> ":/:.gitignore".
>>
>> But then, say people have a file named @foo at top dir. They can write
>> ":/@foo" to address the file. Some time later we decide to use '@' as
>> magic, how can we re-train user's fingers?
>
> You don't.  The primary goal of short form is to be short to type from the
> command line, and if you are in doubt, you can always disambiguate by
> saying ":/:@foo", and you can use the terminating colon even if you are
> sure "@" is not a magic in your version of git.

Actually, after thinking a bit more about it, I changed my mind.

It is not such a big deal to require the terminating colon for a pathname
that begins with a nonalnum (except for '.' and we might find some others
perhaps '_'), as they are rare.

I agree that we should reserve most of the nonalnum ASCII as potential
magic, and require the terminating colon if the user wants to start the
pattern part with a potential magic signature letter and error out if we
see a magic that we do not support yet.  The reason I said "most of" is
that we should exclude some non-alnum letters that often begin a filename.

Off the top of my head, we should exclude "." (period -- dot-files are
common), "_" (underscore), and possibly "+" (plus) and "=" (equal), as I
saw these used to start filenames, but the latter two are rather rare and
I don't mind requiring the terminating colon after the magic signature.
--
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]