6

I'm trying to ignore the file img/test.jpg from being followed by SVN. Prompted by this question I have tried the command:

svn propset svn:ignore "img/test.jpg" .

Instead of ignoring img/test.jpg, SVN tells me property 'svn:ignore' set on '.'.

Also, when I do svn status I now get the extra line:

 M      .

How can have SVN ignore a file?

Community
  • 1
  • 1
Randomblue
  • 112,777
  • 145
  • 353
  • 547

2 Answers2

10

Despite confusing output, your command appears to have worked correctly. The line

M    .

...indicates that you have set a property on the current directory (the one you ran the command from). The ignored path is ./img/test.jpg, but the property is set on the current directory rather than the specific file. It has a modified flag M because you have yet to commit the property back to the repository. After you commit this, subsequent checkouts or others working on this codebase after svn update will also get the svn:ignore property on that file.

Note: To modify or remove this via svn propdel, you would need to do so from the current directory as well:

svn propdel svn:ignore .

You could have also cd'ed into the img/ directory and run the propset in there, in which case it would be bound to that directory rather than its parent. Your commit would then look something like:

M    img
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Michael Berkowski
  • 267,341
  • 46
  • 444
  • 390
-1

You have to set the property on the img directory, not the root:

svn propset svn:ignore "test.jpg" img
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
timomeinen
  • 3,101
  • 3
  • 33
  • 46
  • 1
    OP **can** use any directory in the tree below file-to-be-ignored as mount-point and relative path to file in definition – Lazy Badger Jun 25 '13 at 10:36
  • @LazyBadger This does not work for me. I have a file in a subdirectory, call `svn propset svn:ignore "folder\file.txt" .`. Then I see `M .` like mentioned. However, after committing `.`, `svn st` still shows the file under `folder\file.txt`. However, the solution I suggested, works for me. – timomeinen Jun 25 '13 at 12:50
  • 1
    1. You **can't ignore already versioned** file, only "unknown" 2. You **must to re-read** SVN-Book – Lazy Badger Jun 25 '13 at 15:54
  • @LazyBadger The file.txt in my example was unversioned. I copied the example to pastebin [here](http://pastebin.com/ay4nB2vj). Could you please explain, why the referencing via 'subfolder' does not work and the direct change of the _img_ directory does. Thanks. – timomeinen Jun 26 '13 at 07:26