Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN: Ignore but NOT delete a folder

I have a junk folder, where my application puts temporary files. I don't want to commit them (surely), but the folder must exists or application will crash.

If I use standard TortoiseSVN ignore feature, it will add "svn:ignore junk_folder" property to parent folder, but it will also delete "junk_folder" which cannot happen.

If I revert only delete operation (did by TortoiseSVN) but leave adding "svn:ignore" property, this solution will fail. TortoiseSVN will report files inside "junk_folder" as non-versioned, which I want to avoid.

Is there any solution that would allow me to completely ignore particular folder in SVN (so no matter, what will be put in it, won't be reported as unversioned and won't be auto commited as well) without deleting it?

EDIT: I forgot to add that I'm talking about already versioned folder. It seems that, if you ignore (svn:ignore or proper option in TortoiseSVN) a folder that wasn't yet versioned (before first commit) then everything is OK. But, if you do this on the folder that already was in repository, TortoiseSVN marks it as deleted and deletes it from both repository (but not from Local Working Copy) upon next commit.

like image 626
trejder Avatar asked Jun 20 '12 15:06

trejder


2 Answers

I believe you can just add an svn:ignore for "*" within that folder, instead of on "junk_folder" itself (in other words, ignore "junk_folder/*").

I don't know if TortoiseSVN has a button for that, but from the command line you can do it with the command:

svn propset svn:ignore "*" junk_folder

(at least I think that is the right syntax, off the top of my head. if someone thinks that is wrong, please correct me)

like image 109
CodingWithSpike Avatar answered Nov 10 '22 02:11

CodingWithSpike


I use this for things like compiler intermediate output folders, and it has never deleted anything.

To re-test this, I found an unversioned directory in one of my working copies. I right clicked on the directory, and navigated to the "Add to ignore list" option. It expanded to the directory name. I selected the directory name and received a pop up message noting that it had been added to the ignore list. Checking the working copy status, the parent folder had a property only modification. No files were marked for deletion.

Ignoring Files And Directories

enter image description here

As a side note, you can also hide unversioned files when using "Check for Modifications" and Commit dialogs with a checkbox near the bottom of the dialog.

like image 42
crashmstr Avatar answered Nov 10 '22 02:11

crashmstr