<div dir="ltr">I would voice a word of caution on using submodules in Git. Yes, they are similar to svn:externals, but in my experience, they are very fragile. The fragility comes in when/if you need to switch the submodule URL/definition from what it is currently to something else. I've had no end of trouble with this, as have several others. <div>
<br></div><div>My current take on Git submodules is that I either don't use them, or I fork whatever it is I'd want as a submodule, and reference my fork as the submodule. That way, if I need to make changes, switch from someone's git repo of something to someone else's or whatever, all that is contained in my fork, instead of having to switch the submodule in my project.<br>
<br><div class="gmail_quote">On Tue, Sep 2, 2008 at 2:49 PM, Tim Haines <span dir="ltr"><<a href="mailto:tmhaines@gmail.com">tmhaines@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div dir="ltr">Hi James,<br><br>Thanks for writing these instructions up in detail. I've just followed them and will play around with them over the next few days. A couple of questions<br><br>1) I assume with submodules I can create and switch to branches of the submodules if I want to try my app out with some patches applied to rspec or rails? There's no hidden gotch'ya here?<br>
<br>2) When I'm getting near deployment for production (a few months away yet) I'm thinking of freezing to a tagged version of Rails. (Not sure this terminology is still correct with Git - but basically I might stick with Rails 2.2 or something - but I'm not sure this has benefits anymore). How would you go about this?<br>
<br>Cheers,<br><br>Tim. <br><br><div class="gmail_quote">On Tue, Jun 3, 2008 at 3:14 AM, James B. Byrne <span dir="ltr"><<a href="mailto:byrnejb@harte-lyne.ca" target="_blank">byrnejb@harte-lyne.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<br>
><br>
> Message: 2<br>
> Date: Thu, 29 May 2008 06:35:01 -0700<br>
> From: David Chelimsky <<a href="mailto:dchelimsky@gmail.com" target="_blank">dchelimsky@gmail.com</a>><br>
> Subject: Re: [rspec-users] Coloured output in rspec 1.1.4<br>
> To: <a href="mailto:rspec-users@rubyforge.org" target="_blank">rspec-users@rubyforge.org</a><br>
> Message-ID: <<a href="mailto:175B70FE-B706-4C03-8B20-C5B207268AD6@gmail.com" target="_blank">175B70FE-B706-4C03-8B20-C5B207268AD6@gmail.com</a>><br>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes<br>
><br>
> On May 29, 2008, at 6:32 AM, Juanma Cervera wrote:<br>
><br>
>> David Chelimsky wrote:<br>
>>><br>
>>> Actually - that is not from 1.1.4 - it's a patch that was introduced<br>
>>> after the 1.1.4 release. Did you follow the install directions at<br>
>>> <a href="http://github.com/dchelimsky/rspec-rails/wikis" target="_blank">http://github.com/dchelimsky/rspec-rails/wikis</a>?<br>
>><br>
>> More or less.<br>
>> I have git-cloned from github repositories instead of make<br>
>> "script/plugin install"<br>
><br>
> script/plugin install doesn't support getting a specific version from<br>
> git yet. To do that you have to use 'git clone' and then 'git checkout<br>
> 1.1.4' (in this case).<br>
><br>
<br>
As an alternative to script/plugin or git-clone, you can employ git-submodules<br>
(on GiT v1.5.3 or later) to obtain the effect of subversion externals. For<br>
example:<br>
<br>
---><br>
<br>
$ git-submodule add \<br>
git://<a href="http://github.com/dchelimsky/rspec.git" target="_blank">github.com/dchelimsky/rspec.git</a> \<br>
vendor/plugins/rspec<br>
<br>
Initialized empty Git repository in<br>
/home/byrnejb/projects/proforma.git/vendor/plugins/rspec/.git/<br>
remote: Counting objects: 46810, done.<br>
remote: Compressing objects: 100% (10646/10646), done.<br>
remote: Total 46810 (delta 33521), reused 46810 (delta 33521)<br>
Receiving objects: 100% (46810/46810), 5.99 MiB | 103 KiB/s, done.<br>
Resolving deltas: 100% (33521/33521), done.<br>
<br>
$ ll vendor/plugins<br>
total 16<br>
drwxrwxr-x 6 byrnejb byrnejb 4096 May 28 14:06 routing_navigator<br>
drwxrwxr-x 12 byrnejb byrnejb 4096 Jun 2 10:09 rspec<br>
<br>
$ git-submodule add \<br>
git://<a href="http://github.com/dchelimsky/rspec-rails.git" target="_blank">github.com/dchelimsky/rspec-rails.git</a> \<br>
vendor/plugins/rspec-rails<br>
<br>
Initialized empty Git repository in<br>
/home/byrnejb/projects/proforma.git/vendor/plugins/rspec-rails/.git/<br>
remote: Counting objects: 46530, done.<br>
remote: Compressing objects: 100% (10649/10649), done.<br>
remote: Total 46530 (delta 33241), reused 46530 (delta 33241)<br>
Receiving objects: 100% (46530/46530), 5.94 MiB | 63 KiB/s, done.<br>
Resolving deltas: 100% (33241/33241), done.<br>
<br>
$ git-status<br>
# On branch master<br>
# Changes to be committed:<br>
# (use "git reset HEAD <file>..." to unstage)<br>
#<br>
# modified: .gitmodules<br>
# new file: vendor/plugins/rspec<br>
# new file: vendor/plugins/rspec-rails<br>
#<br>
<br>
$ git-submodule init<br>
<br>
Submodule 'vendor/plugins/rspec' (git://<a href="http://github.com/dchelimsky/rspec.git" target="_blank">github.com/dchelimsky/rspec.git</a>)<br>
registered for path 'vendor/plugins/rspec'<br>
Submodule 'vendor/plugins/rspec-rails'<br>
(git://<a href="http://github.com/dchelimsky/rspec-rails.git" target="_blank">github.com/dchelimsky/rspec-rails.git</a>) registered for path<br>
'vendor/plugins/rspec-rails'<br>
<br>
$ git-status<br>
# On branch master<br>
# Changes to be committed:<br>
# (use "git reset HEAD <file>..." to unstage)<br>
#<br>
# modified: .gitmodules<br>
# new file: vendor/plugins/rspec<br>
# new file: vendor/plugins/rspec-rails<br>
#<br>
<br>
$ git-commit -m "Added Rspec and Rspec-Rails as submodules"<br>
<br>
Created commit b4d1133: Added Rspec and Rspec-Rails as submodules<br>
3 files changed, 8 insertions(+), 0 deletions(-)<br>
create mode 160000 vendor/plugins/rspec<br>
create mode 160000 vendor/plugins/rspec-rails<br>
<br>
$ git-status<br>
# On branch master<br>
nothing to commit (working directory clean)<br>
<br>
$ git-push # over ssh<br>
!!Warning!! - Any attempt to obtain access to this device without<br>
authorization is a criminal act.<br>
<a href="mailto:byrnejb@vcs-git.hamilton.harte-lyne.ca" target="_blank">byrnejb@vcs-git.hamilton.harte-lyne.ca</a>'s password:<br>
Counting objects: 9, done.<br>
Compressing objects: 100% (5/5), done.<br>
Writing objects: 100% (5/5), 607 bytes, done.<br>
Total 5 (delta 1), reused 0 (delta 0)<br>
To ssh://<a href="http://byrnejb@vcs-git.hamilton.harte-lyne.ca/var/data/vcs-git/hll/proforma.git" target="_blank">byrnejb@vcs-git.hamilton.harte-lyne.ca/var/data/vcs-git/hll/proforma.git</a><br>
ab5353b..b4d1133 master -> master<br>
<br>
$<br>
<br>
<---<br>
<br>
Now, when anyone pulls from the canonical repository they will get Rspec and<br>
Rspec-on-Rails as well, but as submodules pulled directly from the RSpec<br>
repositories. Further, updating all submodules thereafter requires just these<br>
three steps:<br>
<br>
$git-submodule update<br>
$git-commit<br>
$git-push<br>
<br>
This is how I load edge rails as well, as a submodule:<br>
<br>
$ git-submodule add git://<a href="http://github.com/rails/rails.git" target="_blank">github.com/rails/rails.git</a> vendor/rails<br>
$ git-submodule init<br>
$ git-commit<br>
$ git-push<br>
<br>
Once you do this you can locally checkout any version or branch that is<br>
available in the submodule.<br>
<br>
Regards,<br>
<br>
--<br>
*** E-Mail is NOT a SECURE channel ***<br>
James B. Byrne mailto:<a href="mailto:ByrneJB@Harte-Lyne.ca" target="_blank">ByrneJB@Harte-Lyne.ca</a><br>
Harte & Lyne Limited <a href="http://www.harte-lyne.ca" target="_blank">http://www.harte-lyne.ca</a><br>
9 Brockley Drive vox: +1 905 561 1241<br>
Hamilton, Ontario fax: +1 905 561 0757<br>
Canada L8E 3C3<br>
<br>
_______________________________________________<br>
rspec-users mailing list<br>
<a href="mailto:rspec-users@rubyforge.org" target="_blank">rspec-users@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
</blockquote></div><br></div>
<br>_______________________________________________<br>
rspec-users mailing list<br>
<a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Christopher Bailey<br>Cobalt Edge LLC<br>
<a href="http://cobaltedge.com">http://cobaltedge.com</a><br>
</div></div>