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

Re: [PATCH] Teach ignore machinery about pattern "/"

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 3, 2012, 21:49 UTC
Message-ID
<7vbol0xdzj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CACsJy8BSHFzGfsm6qY1LEX9wubKjKXXbJ_WMAiOAUhVGa631Ag@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
Show 16 quoted lines
> On Sat, May 26, 2012 at 11:30 AM, Nguyen Thai Ngoc Duy
> <pclouds@gmail.com> wrote:
>> On Sat, May 26, 2012 at 12:32 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>>>
>>>> Pattern "/" is ambiguous because the slash can mean "anchor the
>>>> pattern to this location" (e.g. /path), but it can also mean
>>>> "match directories only" (e.g. path/). Currently git interprets it as
>>>> the latter except that 'path' is an empty string, which makes this
>>>> pattern totally useless.
>>>
>>> Did the old version interprete it as the former?
>>
>> That calls for bit of testing, which I'll do soon.
>
> "/" is no-op since 1.4.0 (tested with refs/tags/v*),...

So historically we had three possible interpretations of "/", i.e. "/path" that happens to have an empty path, "path/" that happens to have an empty path, and a no-op.

That strongly suggests that we should at least warn when we see "/" that the user is playing with fire by feeding the exclude machinery something without clear semantics.

Doing a no-op might be a safer option than adding it new special case semantics to it, but even then I do not think we should silently ignore it. Silently giving new semantics for this particular special case is out of the question, I would have to say.

Thanks for digging.
Previous: Nguyen Thai Ngoc DuyNext: Caleb Marchent
Message 6 of 7 in “Teach ignore machinery about pattern "/"”
  1. Teach ignore machinery about pattern "/"Nguyễn Thái Ngọc Duy, May 25, 2012
  2. Junio C HamanoMay 25, 2012
  3. Nguyen Thai Ngoc DuyMay 26, 2012
  4. Junio C HamanoMay 27, 2012
  5. Nguyen Thai Ngoc DuyJun 3, 2012
  6. Junio C HamanoJun 3, 2012
  7. Caleb MarchentJun 3, 2012

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.