Loading README.md +73 −0 Original line number Diff line number Diff line Loading @@ -37,9 +37,14 @@ So far the supported VCSs are: Git Support ----------- ### Git Detection Git repositories are detected by the presence of a file or directory named '.git' (`$GIT_DIR`) ### Git Ignore Files Git ignore files are searched for at the following locations: * A `.gitignore` file in each ancestor of the target directory up to the top Loading @@ -60,6 +65,74 @@ Git configuration variables are searched for in the following files: * `$HOME/.gitconfig` * `$GIT_DIR/config` ### Git Patterns Patterns in git ignore files are a modified form of glob pattern which `list-files` attempts (quite successfully) to convert to regular expressions. From the git man page: PATTERN FORMAT · A blank line matches no files, so it can serve as a separator for readability. · A line starting with # serves as a comment. Put a backslash ("\") in front of the first hash for patterns that begin with a hash. · Trailing spaces are ignored unless they are quoted with backslash ("\"). · An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined. Put a backslash ("\") in front of the first "!" for patterns that begin with a literal "!", for example, "\!important!.txt". · If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in Git). · If the pattern does not contain a slash /, Git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file). · Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname. For example, "Documentation/*.html" matches "Documentation/git.html" but not "Documentation/ppc/ppc.html" or "tools/perf/Documentation/perf.html". · A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning: · A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo". · A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth. · A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. · Other consecutive asterisks are considered invalid. [^3]: `$XDG_CONFIG_HOME` defaults to `$HOME/.config` [^4]: This should be `$(prefix)/etc/gitconfig` but the `$(prefix)` value of git is unknown, and many platforms & distributions override the location Loading Loading
README.md +73 −0 Original line number Diff line number Diff line Loading @@ -37,9 +37,14 @@ So far the supported VCSs are: Git Support ----------- ### Git Detection Git repositories are detected by the presence of a file or directory named '.git' (`$GIT_DIR`) ### Git Ignore Files Git ignore files are searched for at the following locations: * A `.gitignore` file in each ancestor of the target directory up to the top Loading @@ -60,6 +65,74 @@ Git configuration variables are searched for in the following files: * `$HOME/.gitconfig` * `$GIT_DIR/config` ### Git Patterns Patterns in git ignore files are a modified form of glob pattern which `list-files` attempts (quite successfully) to convert to regular expressions. From the git man page: PATTERN FORMAT · A blank line matches no files, so it can serve as a separator for readability. · A line starting with # serves as a comment. Put a backslash ("\") in front of the first hash for patterns that begin with a hash. · Trailing spaces are ignored unless they are quoted with backslash ("\"). · An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined. Put a backslash ("\") in front of the first "!" for patterns that begin with a literal "!", for example, "\!important!.txt". · If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in Git). · If the pattern does not contain a slash /, Git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file). · Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname. For example, "Documentation/*.html" matches "Documentation/git.html" but not "Documentation/ppc/ppc.html" or "tools/perf/Documentation/perf.html". · A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning: · A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo". · A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth. · A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. · Other consecutive asterisks are considered invalid. [^3]: `$XDG_CONFIG_HOME` defaults to `$HOME/.config` [^4]: This should be `$(prefix)/etc/gitconfig` but the `$(prefix)` value of git is unknown, and many platforms & distributions override the location Loading