• Home
  • Subversion Hosting
  • Documents
  • Contact Us
  • Members Login

Ignoring Files And Directories

Figure 5.24. Explorer context menu for unversioned files

Explorer context menu for unversioned files

In most projects you will have files and folders that should not be subject to version control. These might include files created by the compiler, *.obj, *.lst, maybe an output folder used to store the executable. Whenever you commit changes, TSVN shows your unversioned files, which fills up the file list in the commit dialog. Of course you can turn off this display, but then you might forget to add a new source file.

The best way to avoid these problems is to add the derived files to the project's ignore list. That way they will never show up in the commit dialog, but genuine unversioned source files will still be flagged up.

If you right click on a single unversioned file, and select the command TortoiseSVNAdd to Ignore List from the context menu, a submenu appears allowing you to select just that file, or all files with the same extension. If you select multiple files, there is no submenu and you can only add those specific files/folders.

If you want to remove one or more items from the ignore list, right click on those items and select TortoiseSVNRemove from Ignore List You can also access a folder's svn:ignore property directly. That allows you to specify more general patterns using filename globbing, described in the section below. Read the section called “Project Settings” for more information on setting properties directly.

The Global Ignore List

Another way to ignore files is to add them to the global ignore list. The big difference here is that the global ignore list is a client property. It applies to all Subversion projects, but on the client PC only. In general it is better to use the svn:ignore property where possible, because it can be applied to specific project areas, and it works for everyone who checks out the project. Read the section called “General Settings” for more information.

Ignoring Versioned Items

Versioned files and folders can never be ignored - that's a feature of Subversion. If you versioned a file by mistake, read the section called “Ignore files which are already versioned” for instructions on how to “unversion” it.

Filename Globbing in Ignore Lists

Subversion's ignore patterns make use of filename globbing, a technique originally used in Unix to specify files using meta-characters as wildcards. The following characters have special meaning:

*

Matches any string of characters, including the empty string (no characters).

Ё

Matches any single character.

[...]

Matches any one of the characters enclosed in the square brackets. Within the brackets, a pair of characters separated by “-” matches any character lexically between the two. For example [AGm-p] matches any one of A, G, m, n, o or p.

The globbing is done by Subversion, so the path delimiter is always /, not the Windows backslash.

Pattern matching is case sensitive, which can cause problems on Windows. You can force case insensitivity the hard way by pairing characters, eg. to ignore *.tmp regardless of case, you could use a pattern like *.[Tt][Mm][Pp].

If directory names are present in a path, they are included in the matching, so pattern Fred.* will match Fred.c but not subdir/Fred.c. This is significant if you add a folder containing some files that you want to be ignored, because those filenames will be preceded with the folder name.

To ignore all CVS folders you should either specify a pattern of *CVS or better, the pair CVS */CVS. The first option works, but would also exclude something called ThisIsNotCVS. Using */CVS alone will not work on an immediate child CVS folder, and CVS alone will not work on subfolders.

If you want an official definition for globbing, you can find it in the IEEE specifications for the shell command language Pattern Matching Notation .

All Plans Include

All plans free for 2008
Trac wiki linked to each repository
Online management tools
Access control lists (ALCs)
Read only or read write users
Secure HTTPS connections
Data mirrored onto backup servers
Disk usage reporting
Online invoices & payments
Unlimited support
Click for Free Subversion Hosting