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.

Gabriel R.
  • 1,186
  • 1
  • 15
  • 29

3 Answers3

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.

Michael Hackner
  • 8,605
  • 2
  • 27
  • 29
  • 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 06 '09 at 21:28
  • 6
    If the files are already under version control, they will never be ignored. – Michael Hackner Nov 06 '09 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 '11 at 08: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 '16 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 '17 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.

Mark Bessey
  • 19,598
  • 4
  • 47
  • 69
  • 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 06 '09 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 http://stackoverflow.com/questions/414879/how-to-remove-a-file-folder-from-a-svn-repository-and-add-to-ignore-list 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 06 '09 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 http://stackoverflow.com/questions/414879/how-to-remove-a-file-folder-from-a-svn-repository-and-add-to-ignore-list and modify it to use tar instead of cp, removing the .svn folders with --exclude. – Mark Bessey Nov 06 '09 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.)

mqsoh
  • 3,180
  • 2
  • 24
  • 26