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, 16:30 UTC
Message-ID
<xmqqh89awprl.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190531074426.6810-1-admin@in-ici.net>
"Dr. Adam Nielsen" <admin@in-ici.net> writes:
Show 14 quoted lines
> gitignore.txt: make slash-rules more readable
>
> Remove meta-rule in a paragraph for trailing-slash.
> Be precise whenever a trailing slash would make a 
> difference. Improve paragraph for pattern without slash. 
> Remove rule for leading slash because its now redundant. 
> Instead, add examples for leading slash and asterix in 
> example section.
>
> Signed-off-by: Dr. Adam Nielsen <admin@in-ici.net>
>
> ---
>  Documentation/gitignore.txt | 71 ++++++++++++++++++++++++++-----------
>  1 file changed, 50 insertions(+), 21 deletions(-)
I think the updated text is readable, except for one nit.

Specifically, if you took my suggestion in an earlier review to explicitly say that leading slash is merely a workaround for a string without slash to anchor the pattern to the directory and it should be treated as if it does not exist otherwise, then ...

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

Besides, one extra reason why these two have the same effect is not given in the updated text to explain away "To which substring of path 'doc/frotz' does that leading slash in /doc/frotz match?"

The updated text does not seem to explain that the leading slash is merely to pretend that the pattern "contains a slash so it does not apply in a subdirectory" and for the purpose of pattern matching the slash does not participate in the textual match, which seems to have been lost in the updated patch, relative to the suggestions raised in the review of earlier rounds.

The updated description on trailing slash as type specifier (i.e. directory-only) is much easier to follow compared to the earlier rounds of this patch, I would think.

Thanks.
Previous: Dr. Adam NielsenNext: Dr. Adam Nielsen
Message 2 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.