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

Re: [PATCH] make slash-rules more readable

From
Junio C Hamano <gitster@pobox.com>
Date
May 31, 2019, 17:40 UTC
Message-ID
<xmqq1s0ewmin.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<88c6cf45-3908-6561-c3bf-11adf628f8af@in-ici.net>
"Dr. Adam Nielsen" <admin@in-ici.net> writes:
Show 16 quoted lines
>>> + - The pattern `doc/frotz` and `/doc/frotz` have the same effect
>>> +   in any `.gitignore` file. Both pattern contain a non-trailing
>>> +   slash and thus match relative to the location of the
>>> +   `.gitignore` file.
>>
>> ... this paragraph wouldn't have been necessary.
>
> I think this above example follows from (and thus isn't necessary, but
> just a fine example)
>
>     + - The pattern is matched relative to the location of
>     +   the `.gitignore` file. Except if the pattern contains
>     +   no slash [...]
>
> Because a pattern with a leading slash has a slash, it "is matched
> relative to the location of the `.gitignore` file".

But that does not explain why the pattern /doc/frotz matches the path doc/frotz. A reader can understand 'd' (the second letter in the patern) would match 'd' (the firstr letter in the path), 'o' with 'o', etc., but nobody told the reader which substring of the path consumes the leading '/' in the pattern as matched.

>>  - A leading slash, if any, is implicitly removed before matching the
>>    pattern with the pathname, but the pattern still counts as having
>>    a non-trailing slash for the purpose of the above rule.

Yeah, that would be an addition that makes the updated text more complete.

Previous: Dr. Adam NielsenNext: Philip Oakley
Message 4 of 11 in “make slash-rules more readable”
  1. make slash-rules more readableDr. Adam Nielsen, May 31, 2019
  2. Junio C HamanoMay 31, 2019
  3. Dr. Adam NielsenMay 31, 2019
  4. Junio C HamanoMay 31, 2019
  5. Philip OakleyJun 1, 2019
  6. Dr. Adam NielsenJun 2, 2019
  7. Junio C HamanoJun 3, 2019
  8. Philip OakleyJun 4, 2019
  9. Philip OakleyJun 1, 2019
  10. Philip OakleyJun 4, 2019
  11. Dr. Adam NielsenJun 4, 2019

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.