# Subversion and tmp directory in Rails 1.1 project

**URL:** <https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518>\
**Category:** Rails\
**Created:** [May 3, 2006, 7:20pm UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518 "2006-05-03T19:20:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [May 3, 2006, 7:20pm UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518/1 "2006-05-03T19:20:23Z")

</div>

Hello everyone!

I’m thinking of the right way to store tmp/ directory of Rails 1.1  
project in Subversion. It has cache, session and sockets  
subdirectories. To me, it looks good to have

svn delete tmp/\*  
svn propset svn:ignore “\*” tmp

So it will ignore all directories and files in tmp/. Even if you  
create sessions/ and put some files in it, tmp/ content is still  
ignored.

But I’m not sure whether it is safe to assume that Rails will recreate  
(at least in Webrick I run they are recreated on start-up) these  
cache/ sessions/ and sockets/ directories in future? Is is safe to  
remove them?

The second way is to set svn:ignore 4 times, and it is not safe, if  
more directories will be introduced in future.

svn propset svn:ignore “_" tmp  
svn propset svn:ignore "_” tmp/cache  
svn propset svn:ignore “_" tmp/sessions  
svn propset svn:ignore "_” tmp/sockets

What do you think of it? What is your experience with non-webrick  
deployment?

Peace,  
olegf

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [May 3, 2006, 7:51pm UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518/2 "2006-05-03T19:51:19Z")

</div>

Oleg F. wrote:

> create sessions/ and put some files in it, tmp/ content is still  
> ignored.
> 
> But I’m not sure whether it is safe to assume that Rails will recreate  
> (at least in Webrick I run they are recreated on start-up) these  
> cache/ sessions/ and sockets/ directories in future? Is is safe to  
> remove them?
> 
> The second way is to set svn:ignore 4 times, and it is not safe, if  
> more directories will be introduced in future.

> svn propset svn:ignore “_" tmp  
> svn propset svn:ignore "_” tmp/cache  
> svn propset svn:ignore “_" tmp/sessions  
> svn propset svn:ignore "_” tmp/sockets

I would use this one, so when you get a fresh checkout of your project,  
you get  
all the directories that Rails needs. Otherwise, Rails may not start  
correctly  
when you move from development to production, and finding out why your  
app isn’t  
running correctly in production (say with lighttpd) is a little harder.

Blair

–  
Blair Z., Ph.D.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subversion training, consulting and support  
[http://www.orcaware.com/svn/](http://www.orcaware.com/svn/)

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [May 3, 2006, 7:29pm UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518/3 "2006-05-03T19:29:45Z")

</div>

I just noticed the tmp directory. What is it?

Thanks,  
Peter

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [May 3, 2006, 10:57pm UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518/4 "2006-05-03T22:57:12Z")

</div>

Hello Oleg,

2006/5/3, Oleg F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I’m thinking of the right way to store tmp/ directory of Rails 1.1  
> project in Subversion. It has cache, session and sockets  
> subdirectories. To me, it looks good to have

Please take a look at my Subversion primer:  
[http://blog.teksol.info/articles/2006/03/09/subversion-primer-for-rails-projects](http://blog.teksol.info/articles/2006/03/09/subversion-primer-for-rails-projects)

It explains this concept and other ones as well.

Hope that helps !

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [May 3, 2006, 11:37pm UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518/5 "2006-05-03T23:37:59Z")

</div>

Hello Oleg !

2006/5/3, Oleg F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> it means that files and folders in tmp/ will be ignored. But cache/,  
> sessions/ and sockets/ are already there and they will not inherit  
> this property (svn:ignore is not inherited). So if you create, say,  
> ruby\_sess.da832dc557430c1e in tmp/sessions/ this file will be known as  
> ? to subversion. I use subversion client 1.3.1 on windows and server  
> 1.3.0 on linux. But I believe this is expected behaviour.

Nope, that’s normal. Since we told Subversion to ignore anything in  
tmp/, it WILL ignore everything, including children of said folder.

> I understand now, that this question really should go to the Rails  
> core team. Will Rails recreate the tmp/ stucture on startup and we can  
> do
> 
> svn delete tmp/\*  
> svn propset svn:ignore “\*” tmp/
> 
> or we could expect that auto-create tmp structure can be changed in future?

Rails does recreate the structure, which is why it the primer doesn’t  
put anything in tmp/ under VC.

Bye !

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [May 3, 2006, 11:09pm UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518/6 "2006-05-03T23:09:40Z")

</div>

Hi,

Thanks for the link. Actually it was this material I started from. You  
are doing  
svn propset svn:ignore “\*” tmp  
it means that files and folders in tmp/ will be ignored. But cache/,  
sessions/ and sockets/ are already there and they will not inherit  
this property (svn:ignore is not inherited). So if you create, say,  
ruby\_sess.da832dc557430c1e in tmp/sessions/ this file will be known as  
? to subversion. I use subversion client 1.3.1 on windows and server  
1.3.0 on linux. But I believe this is expected behaviour.

I understand now, that this question really should go to the Rails  
core team. Will Rails recreate the tmp/ stucture on startup and we can  
do

svn delete tmp/\*  
svn propset svn:ignore “\*” tmp/

or we could expect that auto-create tmp structure can be changed in  
future?

Peace,  
olegf

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [May 4, 2006, 11:56am UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518/7 "2006-05-04T11:56:55Z")

</div>

Hi,

On 5/4/06, Francois B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Nope, that’s normal. Since we told Subversion to ignore anything in  
> tmp/, it WILL ignore everything, including children of said folder.

I do not agree. Please take a look at Subversion documentation  
[Properties](http://svnbook.red-bean.com/en/1.1/ch07s02.html#id3022585). Footnote  
[29]. Your solution is incomplete and shouldn’t work. Here is the  
proof.

1. I create project  
d:\> rails testapp2
2. I import this project  
d:\testapp2\> svn import svn://localhost/testapp2/trunk
3. I remove folder out of the way  
d:\> move testapp2 testapp2.old
4. I checkout the project  
d:\> svn co svn://localhost/testapp2/trunk testapp2
5. I set up to ignore everything in tmp/  
d:\testapp2\> svn propset svn:ignore “\*” tmp/
6. I commit changes  
d:\testapp2\> svn commit -m “ignore tmp from now”

Now, as you say, files in subfolders will be ignored. But this is not  
true. svn:ignore is not inherited by subfolders. You are ignoring  
cache/ sessions/ and sockets/ and every file and child directory in  
tmp/, but not _subchildrens_. Here is the proof.

1. I create text file in tmp/  
tmp/sess1

2. I do svn stat and this file is ignored. This is expected.  
d:\testapp2\> svn stat

3. I create text file in sessions  
tmp/sessions/sess2

4. I do svn stat and this file is not ignore. This is expected too  
for svn:ignore is _not_ inherited by subchild folders.  
d:\testapp2\> svn stat  
? tmp\sessions\sess2

I use subversion 1.3.1 on windows xp (i tested linux server too).

Peace,  
olegf

P.S.  
I mean no offence to you. I found your tutorial very valuable, but I  
believe you made a mistake with tmp/ directory 🙂

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [May 5, 2006, 9:57am UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518/8 "2006-05-05T09:57:50Z")

</div>

Yes, if you are not checking in tmp/ content (sessions, cache and  
friends) then your solution will work. Actually, that what my first  
post was about: is it the right way to assume, that sessions/ cache/  
and friends will be recreated by future Rails versions or I need to  
keep them (empty) in repository.

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [May 4, 2006, 5:12pm UTC](https://www.ruby-forum.com/t/subversion-and-tmp-directory-in-rails-1-1-project/59518/9 "2006-05-04T17:12:34Z")

</div>

Hello Oleg !

2006/5/4, Oleg F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I do not agree. Please take a look at Subversion documentation  
> [Properties](http://svnbook.red-bean.com/en/1.1/ch07s02.html#id3022585). Footnote  
> [29]. Your solution is incomplete and shouldn’t work. Here is the  
> proof.

I do not agree again 🙂 Your recipe is incorrect. In my own recipe,  
I do not checkin tmp/sessions, tmp/cache and friends. They do not  
exist in the repository.

> d:\> rails testapp2  
> d:\testapp2\> svn import svn://localhost/testapp2/trunk

This is your problem. You should revert tmp/sessions, tmp/cache and  
friends before you commit.

> d:\> move testapp2 testapp2.old  
> d:\> svn co svn://localhost/testapp2/trunk testapp2  
> d:\testapp2\> svn propset svn:ignore “\*” tmp/  
> d:\testapp2\> svn commit -m “ignore tmp from now”

Here is a recipe I used to test this:

rd /s/q repos wc  
cls  
svn --version  
svnadmin create repos  
svn co file:///repos wc  
cd wc  
svn mkdir tmp  
svn ci -m “”  
svn ps svn:ignore “\*” tmp  
svn up  
svn ci -m “”  
mkdir tmp\sessions  
touch tmp\sessions\asdf  
svn st

Run that from the drive’s root and you’ll see the difference. At the  
end of this E-Mail, you’ll see a sample run of this recipe.

> I mean no offence to you. I found your tutorial very valuable, but I  
> believe you made a mistake with tmp/ directory 🙂

No offense taken ! Healthy disagreement is fine, as long as it’s  
civil and all parties are having fun 🙂

## Have a nice day !

FranÃ§ois Beausoleil  
[http://blog.teksol.info/](http://blog.teksol.info/)

# SAMPLE RUN

$ svn --version  
svn, version 1.3.0 (r17949)  
compiled Jan 15 2006, 23:18:48

$ svnadmin create repos

$ svn co file:///repos wc  
A wc\tmp  
Checked out revision 2.

$ cd wc

$ svn mkdir tmp  
svn: Can’t create directory ‘tmp’

$ svn ci -m “”

$ svn ps svn:ignore “\*” tmp  
property ‘svn:ignore’ set on ‘tmp’

$ svn up  
At revision 2.

$ svn ci -m “”

$ mkdir tmp\sessions

$ touch tmp\sessions\asdf

$ svn st

$
