12

Take folder files, inside an SVN working copy, running in Linux. The folder was set to be ignored, with the commands:

  • svn propset svn:ignore * 'files'
  • svn propset svn:ignore 'default/files'
  • and a few other combination, all valid AFAIK

However, the setting just doesn't kick it. If the repository is accessed with a dektop client (ie Cornerstone on Mac OS) the folder is correctly reported as ignored.

I am scratching my head real hard here.

Thanks.

The answer that cleared it out for me is in this comment:
If the files are already under version control, they will never be ignored.

3 Answers 3

26

If you want to ignore a directory files, you need to svn propset svn:ignore files on its PARENT directory, not the directory itself.

e.g.

# your directory structure is this:
# workingCopy
# workingCopy/parent
# workingCopy/parent/subfolder
# to ignore subfolder do this:
svn propset svn:ignore subfolder workingCopy/parent

Edit

If there are files within this folder that are under version control, Subversion will NOT ignore them even if the folder is ignored. You will need to remove them from version control (i.e. svn delete) and then they will be ignored.

A file being under version control takes precedence over any ignore lists that may include it.

5
  • I did it before and tried it again. Running svn status would still report a bunch of new or changed files inside subfolder. They are sent to the server with svn commit too. This is puzzling.
    – Gabriel R.
    Nov 6, 2009 at 21:28
  • 6
    If the files are already under version control, they will never be ignored. Nov 6, 2009 at 21:31
  • 1
    I fixed this with mv problemDir problemDir.bak, remove it from subversion with svn rm problemDir, then clean all the .svn out of the backup directory: find problemDir.bak -name .svn -exec rm -rf {} \;, then move the directory back: mv problemDir.bak problemDir. After that, I did svn propset svn:ignore problemDir . and a svn ci -m 'your message here' cleanup commit to bake in the svn:ignore.
    – Eric
    Dec 28, 2011 at 8:13
  • if files are already in repo : svn rm them, add them to ignore, never commit ; your svn status is now polluted
    – Belun
    Jul 22, 2016 at 16:25
  • this: "on its PARENT directory, not the directory itself." solved a similar svn issue I had! voted up. thank you so much!
    – Grisgram
    Sep 18, 2017 at 20:00
2

So close.

I think you wanted

svn propset svn:ignore files .

if you execute this in the parent directory of the files directory, it'll be ignored. You won't see the effect until the parent is committed, though. And I'm pretty sure you can't ignore a directory that contains versioned files.

Finally, I always use propedit rather than propset, so I don't lose any current settings.

3
  • Actually, it's propset PROPNAME PROPVAL PATH, you swapped the two last arguments. Yet it's so simple to quickly check before posting a solution ;-)
    – RedGlyph
    Nov 6, 2009 at 19:08
  • > And I'm pretty sure you can't ignore a directory that contains versioned files. Ah... this is what I've suspected. Is there be away to undo this somehow? I've found this stackoverflow.com/questions/414879/… previous question, but the answer isn't clearing the .svn folders, so I am wondering if that may cause issues. Thanks for all the answers.
    – Gabriel R.
    Nov 6, 2009 at 21:22
  • In most cases, it's probably easier to just "svn rm" the files, then re-generate them. It's generally a bad idea to copy folders around in your working copy, because the .svn info can confuse the client software. Ypu could take the script from stackoverflow.com/questions/414879/… and modify it to use tar instead of cp, removing the .svn folders with --exclude. Nov 6, 2009 at 23:31
1

How are you testing it? If you

svn commit files

Then the ignore isn't checked. If you svn commit ., then the automatic behavior of Subversion will ignore it. (This confused me at one point, too. Subversion assumes you're smarter than the svn:ignore.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.