views:

250

answers:

1

How can I create a directory link that will survive git submodule update?

Given the following example directory structure:

proj
|-- lib3
|   `-- submod
|       `-- lib
`-- lib

I created a soft link from proj/lib/ to proj/lib3/submod/lib using something like the following command:

brad@bradpc:~/proj/lib$ ln -s ../lib3/submod/lib submodlib

creating the following directory structure:

proj
|-- lib3
|   `-- submod
|       `-- lib
`-- lib
    `-- submodlib

However, running git submodule update destroys my link. I was under the impression that a soft link is a logical link to a relative path, so removing the object and re-adding it would keep the link intact. How can I achieve the desired effect?

+1  A: 

A soft link made with ln -s should behave like you intended. As I understand it, if you do a git submodule update some part of your directory proj/lib3/submod/lib gets deleteted and recreated. That means there's no difference in that, than manually do a rm proj/lib3/submod and after that a mkdir -p proj/lib3/submod/lib for example.

I tested this manually (rm and mkdir) on my openSuse Linux installation and the soft link was still fine after recreating the directory structure.

In which OS enviroment do you work? Perhaps it's not a true softlink.

nulldevice
That's a very good point. I use Kubuntu linux most of the time, although I sometimes shell in from Cygwin if I don't have a copy of linux handy. I'll try this again making sure I do it in linux. Thanks!
brad