{"thread":{"id":"50998","subject":"[PATCH] make slash-rules more readable","startedAt":"2019-04-26T14:34:17Z","lastAt":"2019-04-26T14:34:17Z","messageCount":1,"participants":["Dr. Adam Nielsen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"374562","messageId":"20190426143251.29250-1-admin@in-ici.net","threadId":"50998","inReplyTo":null,"subject":"[PATCH] make slash-rules more readable","fromName":"Dr. Adam Nielsen","fromEmail":"admin@in-ici.net","sentAt":"2019-04-26T14:32:51Z","receivedAt":"2019-04-26T14:34:17Z","isPatch":true,"sender":{"key":"admin@in-ici.net","avatar":"https://avatars.githubusercontent.com/u/1765602?v=4"},"body":"---\n Documentation/gitignore.txt | 37 ++++++++++++++++++++++++-------------\n 1 file changed, 24 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\nindex b5bc9dbff0..3a6fb9117c 100644\n--- a/Documentation/gitignore.txt\n+++ b/Documentation/gitignore.txt\n@@ -89,24 +89,35 @@ PATTERN FORMAT\n    Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n    that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n \n- - If the pattern ends with a slash, it is removed for the\n-   purpose of the following description, but it would only find\n+ - If the pattern ends with a slash, it would only find\n    a match with a directory.  In other words, `foo/` will match a\n    directory `foo` and paths underneath it, but will not match a\n    regular file or a symbolic link `foo` (this is consistent\n    with the way how pathspec works in general in Git).\n \n- - If the pattern does not contain a slash '/', Git treats it as\n-   a shell glob pattern and checks for a match against the\n-   pathname relative to the location of the `.gitignore` file\n-   (relative to the toplevel of the work tree if not from a\n-   `.gitignore` file).\n-\n- - Otherwise, Git treats the pattern as a shell glob: \"`*`\" matches\n-   anything except \"`/`\", \"`?`\" matches any one character except \"`/`\"\n-   and \"`[]`\" matches one character in a selected range. See\n-   fnmatch(3) and the FNM_PATHNAME flag for a more detailed\n-   description.\n+ - If the pattern contains no slash \"`/`\" (except an optional trailing slash),\n+   the pattern is matched against all files and folders (recursively)\n+   from the location of the `.gitignore` file.\n+   For example, `frotz/` matches `frotz` and `a/frotz` that\n+   is a directory (relative from the `.gitignore` file). \n+\n+ - A pattern that contains a non-trailing slash is matched relative to the \n+   location of the `.gitignore` file.\n+   For example, `doc/frotz/` matches `doc/frotz` directory, but not \n+   `a/doc/frotz` (relative from the `.gitignore` file). \n+   Note that the pattern `doc/frotz` and `/doc/frotz`  \n+   have the same effect in any `.gitignore` file, while `/bar` and `bar` \n+   have not the same effect (`/bar` will not match `foo/bar`).\n+\n+ - An asterisk \"`*`\" matches anything except a slash.  A\n+   pattern \"foo/*\", for example, matches \"foo/test.json\" (a\n+   regular file), \"foo/bar\" (a diretory), but it does not match\n+   \"foo/bar/hello.c\" (a regular file), as the asterisk in the\n+   patter does not match \"bar/hello.c\" which has a slash in it.\n+   The character \"`?`\" matches any one character except \"`/`\"\n+   The range notation, e.g. `[a-zA-Z]`, can be used to match\n+   one of the characters in a range. See fnmatch(3) and the \n+   FNM_PATHNAME flag for a more detailed description.\n \n  - A leading slash matches the beginning of the pathname.\n    For example, \"/{asterisk}.c\" matches \"cat-file.c\" but not\n-- \n2.17.1\n\n"}]}