<html lang="en"> <head> <title>Types And Syntax Of Ignore Lists - Stow</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Stow"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Ignore-Lists.html#Ignore-Lists" title="Ignore Lists"> <link rel="prev" href="Motivation-For-Ignore-Lists.html#Motivation-For-Ignore-Lists" title="Motivation For Ignore Lists"> <link rel="next" href="Justification-For-Yet-Another-Set-Of-Ignore-Files.html#Justification-For-Yet-Another-Set-Of-Ignore-Files" title="Justification For Yet Another Set Of Ignore Files"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This manual describes GNU Stow version 2.2.2 (9 November 2015), a program for managing the installation of software packages. Software and documentation is copyrighted by the following: (C) 1993, 1994, 1995, 1996 Bob Glickstein <bobg+stow@zanshin.com> (C) 2000, 2001 Guillaume Morin <gmorin@gnu.org> (C) 2007 Kahlil (Kal) Hodgson <kahlil@internode.on.net> (C) 2011 Adam Spiers <stow@adamspiers.org> Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled ``GNU General Public License'' is included with the modified manual, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Types-And-Syntax-Of-Ignore-Lists"></a> <p> Next: <a rel="next" accesskey="n" href="Justification-For-Yet-Another-Set-Of-Ignore-Files.html#Justification-For-Yet-Another-Set-Of-Ignore-Files">Justification For Yet Another Set Of Ignore Files</a>, Previous: <a rel="previous" accesskey="p" href="Motivation-For-Ignore-Lists.html#Motivation-For-Ignore-Lists">Motivation For Ignore Lists</a>, Up: <a rel="up" accesskey="u" href="Ignore-Lists.html#Ignore-Lists">Ignore Lists</a> <hr> </div> <h3 class="section">4.2 Types And Syntax Of Ignore Lists</h3> <p>If you put Perl regular expressions, one per line, in a <samp><span class="file">.stow-local-ignore</span></samp> file within any top level package directory, in which case any file or directory within that package matching any of these regular expressions will be ignored. In the absence of this package-specific ignore list, Stow will instead use the contents of <samp><span class="file">~/.stow-global-ignore</span></samp>, if it exists. If neither the package-local or global ignore list exist, Stow will use its own built-in default ignore list, which serves as a useful example of the format of these ignore list files: <pre class="example"><pre class="verbatim"> # Comments and blank lines are allowed. RCS .+,v CVS \.\#.+ # CVS conflict files / emacs lock files \.cvsignore \.svn _darcs \.hg \.git \.gitignore .+~ # emacs backup files \#.*\# # emacs autosave files ^/README.* ^/LICENSE.* ^/COPYING </pre></pre> <p>Stow first iterates through the chosen ignore list (built-in, global, or package-local) as per above, stripping out comments (if you want to include the ‘<samp><span class="samp">#</span></samp>’ symbol in a regular expression, escape it with a blackslash) and blank lines, placing each regular expressions into one of two sets depending on whether it contains the ‘<samp><span class="samp">/</span></samp>’ forward slash symbol. <p>Then in order to determine whether a file or directory should be ignored: <ol type=1 start=1> <li>Stow calculates its path relative to the top-level package directory, prefixing that with ‘<samp><span class="samp">/</span></samp>’. If any of the regular expressions containing a ‘<samp><span class="samp">/</span></samp>’ <em>exactly</em><a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a> match a subpath<a rel="footnote" href="#fn-2" name="fnd-2"><sup>2</sup></a> of this relative path, then the file or directory will be ignored. <li>If none of the regular expressions containing a ‘<samp><span class="samp">/</span></samp>’ match in the manner described above, Stow checks whether the <em>basename</em><a rel="footnote" href="#fn-3" name="fnd-3"><sup>3</sup></a> of the file or directory matches <em>exactly</em> against the remaining regular expressions which do not contain a ‘<samp><span class="samp">/</span></samp>’, and if so, ignores the file or directory. <li>Otherwise, the file or directory is not ignored. </ol> <!-- N.B. if you change the examples below, please also consider --> <!-- updating test_examples_in_manual() in t/ignore.t. --> <p>For example, if a file <samp><span class="file">bazqux</span></samp> is in the <samp><span class="file">foo/bar</span></samp> subdirectory of the package directory, Stow would use ‘<samp><span class="samp">/foo/bar/bazqux</span></samp>’ as the text for matching against regular expressions which contain ‘<samp><span class="samp">/</span></samp>’, and ‘<samp><span class="samp">bazqux</span></samp>’ as the text for matching against regular expressions which don't contain ‘<samp><span class="samp">/</span></samp>’. Then regular expressions ‘<samp><span class="samp">bazqux</span></samp>’, ‘<samp><span class="samp">baz.*</span></samp>’, ‘<samp><span class="samp">.*qux</span></samp>’, ‘<samp><span class="samp">bar/.*x</span></samp>’, and ‘<samp><span class="samp">^/foo/.*qux</span></samp>’ would all match (causing the file to be ignored), whereas ‘<samp><span class="samp">bar</span></samp>’, ‘<samp><span class="samp">baz</span></samp>’, ‘<samp><span class="samp">qux</span></samp>’, and ‘<samp><span class="samp">o/bar/b</span></samp>’ would not (although ‘<samp><span class="samp">bar</span></samp>’ would cause its parent directory to be ignored and prevent Stow from recursing into that anyway, in which case the file <samp><span class="file">bazqux</span></samp> would not even be considered for stowing). <p>As a special exception to the above algorithm, any <samp><span class="file">.stow-local-ignore</span></samp> present in the top-level package directory is <em>always</em> ignored, regardless of the contents of any ignore list, because this file serves no purpose outside the stow directory. <!-- =========================================================================== --> <div class="footnote"> <hr> <h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> Exact matching means the regular expression is anchored at the beginning and end, in contrast to unanchored regular expressions which will match a substring.</p> <p class="footnote"><small>[<a name="fn-2" href="#fnd-2">2</a>]</small> In this context, “subpath” means a contiguous subset of path segments; e.g for the relative path <samp><span class="file">one/two/three</span></samp>, there are six valid subpaths: <samp><span class="file">one</span></samp>, <samp><span class="file">two</span></samp>, <samp><span class="file">three</span></samp>, <samp><span class="file">one/two</span></samp>, <samp><span class="file">two/three</span></samp>, <samp><span class="file">one/two/three</span></samp>.</p> <p class="footnote"><small>[<a name="fn-3" href="#fnd-3">3</a>]</small> The “basename” is the name of the file or directory itself, excluding any directory path prefix - as returned by the <samp><span class="command">basename</span></samp> command.</p> <hr></div> </body></html>