git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] glossary-content.txt: remove an obsolete paragrah

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 21, 2013, 18:13 UTC
Message-ID
<xmqqtxf54o83.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1385016260-9718-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
> With the introduction of :(literal), :(glob) and :(icase), :(top) is
> no longer the only recognized magic signature.

You need to re-read the message you took hints that led to this patch from (or, rather, the existing document around the area you are patching, which led to the wording in that message from me).

The above is a list of magic words, but until you add the magic signature ":!not_in_this_directory" for the ":(exclude)" magic word, ":/" still is the only magic signature.

Another moderately related tangent is this phrase in the existing document:

    In the short form, the leading colon `:` is followed by zero or
    more "magic signature" letters (which optionally is terminated
    by another colon `:`), and the remainder is the pattern to match
    against the path. The optional colon that terminates the "magic
    signature" can be omitted if the pattern begins with a character
    that cannot be a "magic signature" and is not a colon.

While it is technically correct, the phrase "a character that cannot be" is somewhat misleading, and I think it needs to be clarified by rephrasing.

As we can see in a later paragaph:
    The "magic signature" consists of an ASCII symbol that is not
    alphanumeric. Currently only the slash `/` is recognized as a
    "magic signature"...

the correct way to read that "a character that cannot be a magic signature" is "a character that is not 'an ASCII symbol that is not alphanumeric'", which means you can do:

	:!/foo	- with magic signatures ! and /, pattern begins at 'f'
	:/#abc  - with magic signatures # and /, pattern begins at 'a',
	          even if in a particular version of Git, '#' magic
		  signature may be invalid and produce an error
	:/:#abc - with magic signature /, pattern is "#abc".

but because the definition of "magic signature" syntax comes later than "cannot be", it is prone to be misinterpreted as "anything that is not currently defined as a magic signature (namely, '/')".

Show 21 quoted lines
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  .. on top of nd/magic-pathspec..
>
>  Documentation/glossary-content.txt | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt
> index e470661..e22b524 100644
> --- a/Documentation/glossary-content.txt
> +++ b/Documentation/glossary-content.txt
> @@ -379,10 +379,6 @@ full pathname may have special meaning:
>  Glob magic is incompatible with literal magic.
>  --
>  +
> -Currently only the slash `/` is recognized as the "magic signature",
> -but it is envisioned that we will support more types of magic in later
> -versions of Git.
> -+
>  A pathspec with only a colon means "there is no pathspec". This form
>  should not be combined with other pathspec.
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 5 of 8 in “diff: restrict pathspec limitations to diff b/f case only”
  1. diff: restrict pathspec limitations to diff b/f case onlyNguyễn Thái Ngọc Duy, Nov 20, 2013
  2. Junio C HamanoNov 20, 2013
  3. 1/2 glossary-content.txt: remove an obsolete paragrahNguyễn Thái Ngọc Duy, Nov 21, 2013
  4. 2/2 glossary-content.txt: fix documentation of "**" patternsNguyễn Thái Ngọc Duy, Nov 21, 2013
  5. Junio C HamanoNov 21, 2013
  6. Junio C HamanoNov 21, 2013
  7. Duy NguyenNov 22, 2013
  8. Junio C HamanoNov 22, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.