Skip to main content

This post is from the CollabNet VersionOne blog and has not been updated since the original publish date.

Last Updated Jun 26, 2013 — Enterprise Agile Planning expert

Repository Dictated Configuration — Part 3 of 3: Global Ignores

Enterprise Agile Planning

Global Ignores

Welcome to the last topic in my three part series on repository dictated configuration (RDC).  In part 2 we talked about the new svn:auto-props property.  Today we’ll discuss the other new inherited property that involves RDC, svn:global-ignores.

Ignoring Unversioned Items Before 1.8

Once again, this is just a quick refresher, if none of this sounds familiar, then give this section of the Version Control with Subversion book a quick read.

Up until 1.7 there were two ways to prevent the svn add and import subcommands from adding certain items we didn’t want to place under version control (as well as making svn status ignore such unversioned items).  Both of these methods still exist in 1.8:

First, is the global-ignores runtime configuration option:

### Set global-ignores to a set of whitespace-delimited globs
### which Subversion will ignore in its 'status' output, and
### while importing or adding files and directories.
### '*' matches leading dots, e.g. '*.rej' matches '.foo.rej'.
global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo __pycache__ *.rej *~ #*# .#* .*.swp .DS_Store

Second is the svn:ignore versioned property.  This property, which can be set on any directory, has a value which is expected to be a newline-delimited list of file patterns that Subversion should ignore.  These patterns are appended to any ignore patterns defined in the runtime configuration.

The svn:global-ignores Property

In Subversion 1.8, these existing ignore mechanisms are joined by the svn:global-ignores property.  This new property is essentially a more powerful version of the svn:ignore property.  Like the earlier property, svn:global-ignores can only be set on a directory and should have as a value a set of newline delimited file patterns 1.  These patterns are appended to any patterns defined in the global-ignores runtime configuration option together with any applicable svn:ignore defined patterns, to determine ignorable items. Unlike svn:ignore however, the svn:global-ignores property is inheritable and applies to all paths under the directory on which the property is set 2, not just the immediate children of the directory.

The following short example demonstrates how this new property works.

The svn:global-ignores patterns are themselves ignored (as are the runtime config global-ignores and the svn:ignore property) when the --no-ignore option is used.  So to see all unversioned items in our working copy, we pass that option to the status subcommand:

1.8.0>svn st --no-ignore
?       calc\trunk\doc\README.foo
I       calc\trunk\file.bar
I       calc\trunk\file.baz
I       calc\trunk\file.foo
I       calc\trunk\file.qux

Here we see that four files are being ignored, while one (README.foo) is unversioned by doesn’t match any ignore patterns.  First, let’s look at the svn:ignore property on calc/trunk:

1.8.0>svn pg svn:ignore -vR
Properties on 'calc\trunk':
  svn:ignore
    *.foo
    *.moo

That accounts for file.foo.  Then we check our runtime configuration and find this snippet:

### Set global-ignores to a set of whitespace-delimited globs
### which Subversion will ignore in its 'status' output, and
### while importing or adding files and directories.
### '*' matches leading dots, e.g. '*.rej' matches '.foo.rej'.
global-ignores = *.qux

That accounts for file.qux.  But what about file.bar and file.baz?  There can be only one option left, the new svn:global-ignores property.  Sure enough, on the root of the repository we find that property, with patterns that account for the remaining two ignored files:

1.8.0>svn pg svn:global-ignores -v --show-inherited-props calc\trunk
Inherited properties on 'calc\trunk',
from '.':
  svn:global-ignores
    *.bar
    *.baz

Final Thoughts

As we discussed in part 2 regarding svn:auto-props, svn:global-ignores should be set as high up the repository tree as is feasible.  And it deserves mention one final time: Be sure you understand the limitations of inherited properties discussed in part 1 — and thus the limitations of RDC via svn:auto-props and svn:global-ignores.

Notes:

  1. It was intended that the ignore patterns in the svn:global-ignores property could be delimited with any whitespace (similar to the global-ignores runtime configuration option), not just newlines (as with the svn:ignore property), but there is a bug in 1.8.0 and only newline separated patterns work.
  2. The caveats I mentioned about inherited properties in part 1 still apply of course!

More from the Blog

View more
Feb 14, 2021

Reflecting on the 20th anniversary of the Agile Manifesto

Enterprise Agile Planning
Over the past 20 years, it’s been amazing to watch an idea from ...
Read More
Feb 08, 2021

How does agile apply to an entire organization?

Enterprise Agile Planning
Before we dive into the main subject of this blog post, it is importan ...
Read More
Feb 03, 2021

It took a pandemic to realize why digital transformation actually matters

Enterprise Agile Planning
Before anyone had ever heard of COVID-19, businesses across the globe ...
Read More
Jan 27, 2021

Improve visibility, reduce costs, and take back control of your scaled out container and cloud deployments with the latest releases of Digital.ai Agility and DevOps solutions

Enterprise Agile Planning
We’re thrilled to announce the latest releases of our Digital.ai Agili ...
Read More
Contact Us