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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:00

Junio C Hamano [off-list ref] writes:
Nguyen Thai Ngoc Duy [off-list ref] writes:
quoted
On Thu, Apr 7, 2011 at 11:18 PM, Junio C Hamano [off-list ref] wrote:
quoted
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.

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

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:51:00

On Fri, Apr 8, 2011 at 11:37 PM, Junio C Hamano [off-list ref] wrote:
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.
Totally agree on dot and underscore. I don't really care the other
two. While '*' is not actually part of path name, '*.[ch]' is commonly
used, and I usually have to quote once to avoid bash expansion
already. So put asterisk in exclude list too, to avoid another quote?
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help