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

Re: Possible bug: Empty magic word list in pathspec is handled differently in short vs. long form

From
Lucas Oshiro <lucasseikioshiro@gmail.com>
Date
Feb 19, 2025, 14:28 UTC
Message-ID
<6CE51CB5-4F14-4737-83EE-05B93500BDF1@gmail.com>
In-Reply-To
<216a7288-b599-4333-ba62-10665d6a94d8@anselmschueler.com>
> If you run git diff for a pathspec with an empty magic word/symbol list in short form (prefixed by ::) and in long form (prefixed by :():), you get different results.
> 
From the gitglossary, pathspec section:

""" 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. """

and:

""" In the long form, the leading colon : is followed by an open parenthesis `(`, a comma-separated list of zero or more "magic words", and a close parentheses `)` , and the remainder is the pattern to match against the path. """

Note that the long form doesn't mention that a second colon has the same meaning as in the short form. In the short form, the second colon is optionally used to separate the magic signatures from the file pattern. It wouldn't be necessary in the long form, as the close parentheses acts just like that.

This way, "::" and ":():" doesn't have the same meaning, just like, for example, ":(exclude):" doesn't mean ":!" (but ":(exclude)" does).

Previous: Anselm SchülerNext: Junio C Hamano
Message 2 of 4 in “Possible bug: Empty magic word list in pathspec is handled differently in short vs. long form”
  1. Anselm SchülerFeb 19, 2025
  2. Lucas OshiroFeb 19, 2025
  3. Junio C HamanoFeb 19, 2025
  4. Anselm SchülerFeb 24, 2025

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.