SVN: Overcommitment

In this post, I describe why Subversion sometimes seems to commit too much.

Suppose you have a working copy containing the following  changes to files and directories:

$ svn status --no-ignore
 M     myproject
I      myproject/config.xml
A      myproject/config.xml.tmpl
M      myproject/file.cpp
M      myproject/readme.txt

That is, you have added a template file <config.xml.tmpl> and have also added the file <config.xml> to the <svn:ignore> property of the directory. You have also made some changes to other the files.

You wish to commit just the config.xml file changes, including the property changes to the directory. So you try this:

$ svn commit myproject myproject/config.xml.tmpl -m "Config template"


Sending        config.xml.tmpl
Sending        file.cpp
Sending        readme.txt
Transmitting file data .....
Committed revision 666.

Why? Because a commit is recursive on the targets by default. Therefore you need to tell SVN to be non-recursive:

$ svn commit --depth empty myproject myproject/config.xml -m "Config template"

That’s better…

Sending        config.xml.tmpl
Transmitting file data .....
Committed revision 666.

The problem occurs when you specify a directory target. If you specify a directory target, remember to tell SVN to what depth you wish it to recurse.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: